🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
DemoInstallSign in
Socket

valid-jpeg

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

valid-jpeg

Very simple node.js package to check if a jpeg image is valid

1.0.2
latest
Source
npm
Version published
Weekly downloads
6
-25%
Maintainers
1
Weekly downloads
 
Created
Source

valid-jpeg

build status

Very simple node.js package to check if a jpeg image is valid

Installation

$ npm install valid-jpeg

Usage

// load the module
const imageValid = require('valid-jpeg');

...

// check if image.jpg is a valid jpeg image
imageValid.isValid('image.jpg', (err, valid) => {
    // check if error occurs
    if(err) 
        console.error('Oh no! Something went wrong!');

    // valid is true if image is a valid jpeg, false otherwise
    if(valid)  
        console.info('Valid jpeg!');
    else
        console.error('Not a valid jpeg');
});

Are you kidding? A simple jpeg checker?

A simple, plug-and-play module to check if a jpeg image is valid does not exist.

This module extracts the first 2 bytes of a file and checks if they are in equals to ffd8 (the magic number used by jpeg image).

That's it! :)

Keywords

jpeg

FAQs

Package last updated on 21 Jun 2018

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