{"_id":"is-jpg","_rev":"259355","name":"is-jpg","description":"Check if a Buffer/Uint8Array is a JPEG image","dist-tags":{"latest":"3.0.0"},"maintainers":[{"name":"sindresorhus","email":""}],"time":{"modified":"2023-03-27T17:07:20.000Z","created":"2014-04-21T17:29:40.577Z","3.0.0":"2021-09-19T08:21:16.870Z","2.0.0":"2018-03-22T15:52:49.394Z","1.0.1":"2018-03-22T15:43:28.099Z","1.0.0":"2014-08-14T14:39:20.490Z","0.1.2":"2014-04-29T19:11:12.916Z","0.1.1":"2014-04-25T23:32:59.719Z","0.1.0":"2014-04-21T17:29:40.577Z"},"users":{},"author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"https://sindresorhus.com"},"repository":{"type":"git","url":"git+https://github.com/sindresorhus/is-jpg.git"},"versions":{"3.0.0":{"name":"is-jpg","version":"3.0.0","description":"Check if a Buffer/Uint8Array is a JPEG image","license":"MIT","repository":{"type":"git","url":"git+https://github.com/sindresorhus/is-jpg.git"},"funding":"https://github.com/sponsors/sindresorhus","author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"https://sindresorhus.com"},"type":"module","exports":"./index.js","engines":{"node":"^12.20.0 || ^14.13.1 || >=16.0.0"},"scripts":{"test":"xo && ava"},"keywords":["jpg","jpeg","image","picture","photo","type","detect","check","is","exif","binary","buffer","uint8array"],"devDependencies":{"ava":"^3.15.0","read-chunk":"^4.0.2","xo":"^0.44.0"},"gitHead":"a1f9fc4dfaed76e043b54cfdf84361e2a1e7a354","bugs":{"url":"https://github.com/sindresorhus/is-jpg/issues"},"homepage":"https://github.com/sindresorhus/is-jpg#readme","_id":"is-jpg@3.0.0","_nodeVersion":"12.22.1","_npmVersion":"7.20.3","dist":{"shasum":"f97b4ab6de92401650cb4f54ec0a6ad79c51367f","size":1672,"noattachment":false,"key":"/is-jpg/-/is-jpg-3.0.0.tgz","tarball":"http://name.csiicloud.com:7001/is-jpg/download/is-jpg-3.0.0.tgz"},"_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"directories":{},"maintainers":[{"name":"sindresorhus","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/is-jpg_3.0.0_1632039676545_0.9755457171538562"},"_hasShrinkwrap":false,"publish_time":1632039676870,"_cnpm_publish_time":1632039676870,"_cnpmcore_publish_time":"2021-12-16T17:53:23.720Z"},"2.0.0":{"name":"is-jpg","version":"2.0.0","description":"Check if a Buffer/Uint8Array is a JPEG image","license":"MIT","repository":{"type":"git","url":"git+https://github.com/sindresorhus/is-jpg.git"},"author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"sindresorhus.com"},"engines":{"node":">=6"},"scripts":{"test":"xo && ava"},"files":["index.js"],"keywords":["jpg","jpeg","image","img","pic","picture","photo","type","detect","check","is","exif","binary","buffer","uint8array","cli","bin"],"devDependencies":{"ava":"*","read-chunk":"^2.1.0","xo":"*"},"gitHead":"3fd03502026a4dca98fd38748344ac71b4110465","bugs":{"url":"https://github.com/sindresorhus/is-jpg/issues"},"homepage":"https://github.com/sindresorhus/is-jpg#readme","_id":"is-jpg@2.0.0","_shasum":"2e1997fa6e9166eaac0242daae443403e4ef1d97","_from":".","_npmVersion":"3.10.10","_nodeVersion":"6.11.0","_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"dist":{"shasum":"2e1997fa6e9166eaac0242daae443403e4ef1d97","size":1721,"noattachment":false,"key":"/is-jpg/-/is-jpg-2.0.0.tgz","tarball":"http://name.csiicloud.com:7001/is-jpg/download/is-jpg-2.0.0.tgz"},"maintainers":[{"name":"sindresorhus","email":""}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/is-jpg_2.0.0_1521733969185_0.5522490664673865"},"_hasShrinkwrap":false,"publish_time":1521733969394,"_cnpm_publish_time":1521733969394},"1.0.1":{"name":"is-jpg","version":"1.0.1","description":"Check if a Buffer/Uint8Array is a JPEG image","license":"MIT","repository":{"type":"git","url":"git+https://github.com/sindresorhus/is-jpg.git"},"author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"http://sindresorhus.com"},"engines":{"node":">=0.10.0"},"scripts":{"test":"mocha"},"files":["index.js"],"keywords":["jpg","jpeg","image","img","pic","picture","photo","type","detect","check","is","exif","binary","buffer","uint8array","cli","bin"],"devDependencies":{"mocha":"*","read-chunk":"^1.0.0"},"gitHead":"e2973d0cca3db187712f716660f393e169a82ce1","bugs":{"url":"https://github.com/sindresorhus/is-jpg/issues"},"homepage":"https://github.com/sindresorhus/is-jpg#readme","_id":"is-jpg@1.0.1","_shasum":"296d57fdd99ce010434a7283e346ab9a1035e975","_from":".","_npmVersion":"3.10.10","_nodeVersion":"6.11.0","_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"dist":{"shasum":"296d57fdd99ce010434a7283e346ab9a1035e975","size":1727,"noattachment":false,"key":"/is-jpg/-/is-jpg-1.0.1.tgz","tarball":"http://name.csiicloud.com:7001/is-jpg/download/is-jpg-1.0.1.tgz"},"maintainers":[{"name":"sindresorhus","email":""}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/is-jpg_1.0.1_1521733408058_0.5738571946469975"},"_hasShrinkwrap":false,"publish_time":1521733408099,"_cnpm_publish_time":1521733408099},"1.0.0":{"name":"is-jpg","version":"1.0.0","description":"Check if a Buffer/Uint8Array is a JPEG image","license":"MIT","repository":{"type":"git","url":"https://github.com/sindresorhus/is-jpg"},"author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"http://sindresorhus.com"},"engines":{"node":">=0.10.0"},"scripts":{"test":"mocha"},"files":["index.js"],"keywords":["jpg","jpeg","image","img","pic","picture","photo","type","detect","check","is","exif","binary","buffer","uint8array","cli","bin"],"devDependencies":{"mocha":"*","read-chunk":"^1.0.0"},"gitHead":"da8e15c730519a7f0ae3ec16d4e2eb510ecd1e30","bugs":{"url":"https://github.com/sindresorhus/is-jpg/issues"},"homepage":"https://github.com/sindresorhus/is-jpg","_id":"is-jpg@1.0.0","_shasum":"2959c17e73430db38264da75b90dd54f2d86da1c","_from":".","_npmVersion":"1.4.21","_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"maintainers":[{"name":"sindresorhus","email":""}],"dist":{"shasum":"2959c17e73430db38264da75b90dd54f2d86da1c","size":1063,"noattachment":false,"key":"/is-jpg/-/is-jpg-1.0.0.tgz","tarball":"http://name.csiicloud.com:7001/is-jpg/download/is-jpg-1.0.0.tgz"},"directories":{},"publish_time":1408027160490,"_cnpm_publish_time":1408027160490,"_hasShrinkwrap":false},"0.1.2":{"name":"is-jpg","version":"0.1.2","description":"Check if a Buffer/Uint8Array is a JPEG image","license":"MIT","repository":{"type":"git","url":"git://github.com/sindresorhus/is-jpg"},"author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"http://sindresorhus.com"},"engines":{"node":">=0.10.0"},"scripts":{"test":"mocha","browser":"browserify -s $npm_package_name -o browser.js ."},"files":["index.js"],"keywords":["jpg","jpeg","image","img","pic","picture","photo","type","detect","check","is","exif","binary","buffer","uint8array","cli","bin"],"devDependencies":{"browserify":"^3.0.0","mocha":"*","read-chunk":"^0.1.0"},"bugs":{"url":"https://github.com/sindresorhus/is-jpg/issues"},"homepage":"https://github.com/sindresorhus/is-jpg","_id":"is-jpg@0.1.2","dist":{"shasum":"a56f6f01fdef4baf448dc44bc6f99cbc9c536715","size":1124,"noattachment":false,"key":"/is-jpg/-/is-jpg-0.1.2.tgz","tarball":"http://name.csiicloud.com:7001/is-jpg/download/is-jpg-0.1.2.tgz"},"_from":".","_npmVersion":"1.4.6","_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"maintainers":[{"name":"sindresorhus","email":""}],"directories":{},"publish_time":1398798672916,"_cnpm_publish_time":1398798672916,"_hasShrinkwrap":false},"0.1.1":{"name":"is-jpg","version":"0.1.1","description":"Check if a Buffer/Uint8Array is a JPEG image","license":"MIT","repository":{"type":"git","url":"git://github.com/sindresorhus/is-jpg"},"author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"http://sindresorhus.com"},"engines":{"node":">=0.10.0"},"scripts":{"test":"mocha","browser":"browserify -s $npm_package_name -o browser.js ."},"files":["index.js"],"keywords":["jpg","jpeg","image","img","pic","picture","photo","type","detect","check","is","exif","binary","buffer","uint8array","cli","bin"],"devDependencies":{"browserify":"^3.0.0","mocha":"*","read-chunk":"^0.1.0"},"bugs":{"url":"https://github.com/sindresorhus/is-jpg/issues"},"homepage":"https://github.com/sindresorhus/is-jpg","_id":"is-jpg@0.1.1","dist":{"shasum":"b9c040efd7d2ae176e8c5938ba8f243e1e9a9d0a","size":1112,"noattachment":false,"key":"/is-jpg/-/is-jpg-0.1.1.tgz","tarball":"http://name.csiicloud.com:7001/is-jpg/download/is-jpg-0.1.1.tgz"},"_from":".","_npmVersion":"1.4.6","_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"maintainers":[{"name":"sindresorhus","email":""}],"directories":{},"publish_time":1398468779719,"_cnpm_publish_time":1398468779719,"_hasShrinkwrap":false},"0.1.0":{"name":"is-jpg","version":"0.1.0","description":"Check if a Buffer/Uint8Array is a JPEG image","license":"MIT","repository":{"type":"git","url":"git://github.com/sindresorhus/is-jpg"},"author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"http://sindresorhus.com"},"engines":{"node":">=0.10.0"},"scripts":{"test":"mocha","browser":"browserify -s $npm_package_name -o browser.js ."},"files":["index.js"],"keywords":["jpg","jpeg","image","img","pic","picture","photo","type","detect","check","is","exif","binary","buffer","uint8array","cli","bin"],"devDependencies":{"browserify":"^3.0.0","mocha":"*","read-chunk":"^0.1.0"},"bugs":{"url":"https://github.com/sindresorhus/is-jpg/issues"},"homepage":"https://github.com/sindresorhus/is-jpg","_id":"is-jpg@0.1.0","dist":{"shasum":"47e5f051a25baa4c1d19b58ffc8dadcd99b48081","size":1128,"noattachment":false,"key":"/is-jpg/-/is-jpg-0.1.0.tgz","tarball":"http://name.csiicloud.com:7001/is-jpg/download/is-jpg-0.1.0.tgz"},"_from":".","_npmVersion":"1.4.6","_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"maintainers":[{"name":"sindresorhus","email":""}],"directories":{},"publish_time":1398101380577,"_cnpm_publish_time":1398101380577,"_hasShrinkwrap":false}},"readme":"# is-jpg\n\n> Check if a Buffer/Uint8Array is a [JPEG](https://en.wikipedia.org/wiki/JPEG) image\n\n## Install\n\n```sh\nnpm install is-jpg\n```\n\n## Usage\n\n##### Node.js\n\n```js\nimport {readChunk} from 'read-chunk';\nimport isJpg from 'is-jpg';\n\nconst buffer = await readChunk('unicorn.jpg', {length: 3});\n\nisJpg(buffer);\n//=> true\n```\n\n##### Browser\n\n```js\nconst xhr = new XMLHttpRequest();\nxhr.open('GET', 'unicorn.jpg');\nxhr.responseType = 'arraybuffer';\n\nxhr.onload = () => {\n\tisJpg(new Uint8Array(this.response));\n\t//=> true\n};\n\nxhr.send();\n```\n\n## API\n\n### isJpg(buffer)\n\nAccepts a `Buffer` (Node.js) or `Uint8Array`.\n\nIt only needs the first 3 bytes.\n\n## Related\n\n- [file-type](https://github.com/sindresorhus/file-type) - Detect the file type of a Buffer/Uint8Array\n","_attachments":{},"homepage":"https://github.com/sindresorhus/is-jpg#readme","bugs":{"url":"https://github.com/sindresorhus/is-jpg/issues"},"license":"MIT"}