
Product
Introducing Reports: An Extensible Reporting Framework for Socket Data
Explore exportable charts for vulnerabilities, dependencies, and usage with Reports, Socket’s new extensible reporting framework.
buffer-signature
Advanced tools
Get the mimetype of a buffer based on its contents.
Data for this script was generated from: http://en.wikipedia.org/wiki/List_of_file_signatures
Additional support for mp4 and mov formats from @cmd430
This is a fork of file-signature by @leahcimic.
To match against any file format, you'll need a minimum of 22 bytes from the start of the file.
var identifyBuffer = require('buffer-signature').identify;
console.log(identifyBuffer(fs.readFileSync('path/to/file.jpg')));
var identifyStream = require('buffer-signature').identifyStream;
fs.createReadStream('path/to/file.jpg').pipe(identifyStream(info => {
console.log(info)
}).pipe(…whatever else you want to do with the data…)
// outputs:
// {
// description: 'A commonly used method of lossy compression for digital photography (image).',
// mimeType: 'image/jpg'
// extensions: ['jpg', 'jpeg']
// }
file-signatureidentify take a buffer instead of a filenameidentifyStreamBuffer.equalsFAQs
Get the mimetype of a buffer based on its contents
The npm package buffer-signature receives a total of 1,038 weekly downloads. As such, buffer-signature popularity was classified as popular.
We found that buffer-signature demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Product
Explore exportable charts for vulnerabilities, dependencies, and usage with Reports, Socket’s new extensible reporting framework.

Product
Socket for Jira lets teams turn alerts into Jira tickets with manual creation, automated ticketing rules, and two-way sync.

Company News
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.