tableflip/isjpeg

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

Homepage:

Size: 504

Language: JavaScript

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

isjpeg

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.

Usage

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
References

This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.