New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

isjpeg

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

isjpeg

is that file really (probably) a jpeg‽

latest
Source
npmnpm
Version
1.0.1
Version published
Maintainers
1
Created
Source

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

var isJpeg = require('isjpeg')

isJpeg('/path/to/mysterious/file', function (err, jpeg) {
  if (err) throw err
  if (jpeg) {
    console.log('file is totes JPEG.')
  } else {
    console.log('ceci n\'est pas une JPEG.')  
  }
})

command line

npm install -g isjpeg

isjpeg ~/Pictures/
/Users/oli/Pictures/MagrittePipe.jpg is JPEG

References

  • http://www.mikekunz.com/image_file_header.html
  • http://stackoverflow.com/questions/772388/c-sharp-how-can-i-test-a-file-is-a-jpeg
  • https://github.com/threatstack/libmagic/blob/master/magic/Magdir/jpeg#L12

Keywords

jpeg

FAQs

Package last updated on 05 Jul 2015

Did you know?

Socket

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.

Install

Related posts