File extractor to get real extension of file given by checking through the file's signature
Using NPM:
npm install isignature
Using Yarn:
yarn add isignature
const { getSignature } = require("isignature");
const somefile = require("./path/to/somefile.jpg");
const data = getSignature(somefile);
console.log(data);
Property | Description | Example |
---|---|---|
value | The exact match extension | jpg |
possibility | The nearest match to your file | ['jpg', 'jpeg'] |
match | The boolean answer if the given file is match | true |
filehex | The short hex value of your file | 00 12 34 56 78 |