buffer-signature
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.
Example use:
var identifyBuffer = identify;console; var identifyStream = identifyStream;fs
file-signature
Changes form - Made
identify
take a buffer instead of a filename - Added
identifyStream
- Refreshed magic number list from Wikipedia and fixed signature matcher to support offsets
- Added a bunch of missing mimetypes
- Ditched bespoke buffer equality function for
Buffer.equals