{"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","tarball":"http://registry-npm.ywwl.com/is-jpg/download/is-jpg-2.0.0.tgz","fileCount":4,"unpackedSize":2955,"integrity":"sha512-ODlO0ruzhkzD3sdynIainVP5eoOFNN85rxA1+cwwnPe4dKyX0r5+hxNO5XpCrxlHcmb9vkOit9mhRD2JVuimHg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDOtTxscu0SqN/yzovcRIO04IppUtDcyJSmTureepEJJQIgTgMDV94B2KXNbnk0xr8cfKQKNy9N66n80oXn2z7bIF8="}],"size":1721,"noattachment":false,"key":"/is-jpg/-/is-jpg-2.0.0.tgz"},"maintainers":[{"name":"sindresorhus","email":"sindresorhus@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/is-jpg_2.0.0_1521733969185_0.5522490664673865"},"_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","publish_time":1521733969394,"_cnpm_publish_time":1521733969394,"dist-tags":{"latest":"3.0.0"}}