Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including file-signature with all npm packages installed. Try it out:

var fileSignature = require("file-signature")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

file-signature v1.0.0

Get file information based on file signature

file-signature Build Status

Get file information based on file signature. This utility is used to get file information based on the file signature. It does so by looking at "magic numbers" common formats contain.

Data for this script was generated from: http://en.wikipedia.org/wiki/List_of_file_signatures

Example use:


var fileSignature = require('file-signature');
console.log(fileSignature.identify('path/to/file.jpg'));

// outputs:
// {
//   extension: 'jpg',
//   description: 'A commonly used method of lossy compression for digital photography (image).',
//   mimeType: 'image/jpg'
// }

Metadata

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free