How to check for restricted file while uploading in react

if a person renames the file extension to an allowed one let say abc.exe to abc.pdf and try to upload it.

I want to know if there are any open source library available in React/JavaScript to detect the content in the file so that no executable or malicious code is checked in even if the extension of the file is changed to what is allowed in the code