is-jpg
Advanced tools
Comparing version 0.1.0 to 0.1.1
'use strict'; | ||
module.exports = function (buf) { | ||
if (!buf || buf.length < 4) { | ||
if (!buf || buf.length < 3) { | ||
return false; | ||
@@ -9,4 +9,3 @@ } | ||
buf[1] === 216 && | ||
buf[2] === 255 && | ||
(buf[3] === 224 || buf[3] === 225); | ||
buf[2] === 255; | ||
}; |
{ | ||
"name": "is-jpg", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"description": "Check if a Buffer/Uint8Array is a JPEG image", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
@@ -30,3 +30,3 @@ # is-jpg [![Build Status](https://travis-ci.org/sindresorhus/is-jpg.svg?branch=master)](https://travis-ci.org/sindresorhus/is-jpg) | ||
var isJpg = require('is-jpg'); | ||
var buffer = readChunk('unicorn.jpg', 0, 4); | ||
var buffer = readChunk('unicorn.jpg', 0, 3); | ||
@@ -59,3 +59,3 @@ isJpg(buffer); | ||
It only needs the first 4 bytes. | ||
It only needs the first 3 bytes. | ||
@@ -62,0 +62,0 @@ |
Trivial Package
Supply chain riskPackages less than 10 lines of code are easily copied into your own project and may not warrant the additional supply chain risk of an external dependency.
Found 1 instance in 1 package
Trivial Package
Supply chain riskPackages less than 10 lines of code are easily copied into your own project and may not warrant the additional supply chain risk of an external dependency.
Found 1 instance in 1 package
1993
9