You may want to check out "TrID - File Identifier", a free and underestimated CLI program that already performs similar functions with a huge database.
This is a Rust command-line application that wraps infer cargo, a utility to check the file type using the magic number signature. The application makes it easy to test the infer crate without integrating it into your application.
Note You do not need to have Rust installed on your device to use this CLI.
Download the latest binary.
To use it, simply run infertype.exe
with the check
command and provide the path(s) to the file you want to check. For example:
$ infertype.exe check infertype.exe README.md
* "infertype.exe" application/vnd.microsoft portable-executable
* "README.md" Unknown # For this reason I made this CLI