Name: isjpeg
Owner: TABLEFLIP
Description: :rainbow: is that file really (probably) a jpeg?
Created: 2015-07-05 23:13:39.0
Updated: 2015-07-05 23:34:10.0
Pushed: 2015-07-05 23:32:53.0
Size: 504
Language: JavaScript
GitHub Committers
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
is that file really (probably) a jpeg?
Check the first 2 bytes of the file header to see if it's a JPEG
For when you just don't trust file extensions anymore.
module
npm install isjpeg
isJpeg = require('isjpeg')
eg('/path/to/mysterious/file', function (err, jpeg) {
(err) throw err
(jpeg) {
console.log('file is totes JPEG.')
else {
console.log('ceci n\'est pas une JPEG.')
command line
npm install -g isjpeg
eg ~/Pictures/
rs/oli/Pictures/MagrittePipe.jpg is JPEG