{"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":{"integrity":"sha512-Vcd67KWHZblEKEBrtP25qLZ8wN9ICoAhl1pKUqD7SM7hf2qtuRl7loDgP5Zigh2oN/+7uj+KVyC0eRJvgOEFeQ==","shasum":"f97b4ab6de92401650cb4f54ec0a6ad79c51367f","tarball":"http://registry-npm.ywwl.com/is-jpg/download/is-jpg-3.0.0.tgz","fileCount":4,"unpackedSize":2820,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJh2wE9CRA9TVsSAnZWagAA/tcP+gMCkA0ycZ6DXN0Pnj6R\nDToTGchXJlxkz0UAqIMG0xvHyrGil0oGsYg31tUrYSqagxVpUrUnrIy5W4rB\n9O+ygpRFd202BlSQVxhDX9SEaPng4Gf744nNEgqLEDoA/UsgUOQvIVBvyPS1\niX5KdzCqNbVsq/Nh71SujmRpNHpL7DDTxNudHmUGyA3tgY7HJkV1neW5v1JD\nAjx6dLGGZ3IqGyw8eYpb1r99USk6wvPUoC3oLs85gDukTdJz1ThvwHMBczxk\nCu7MhFEpepMTzJcYh5UwFOhyrK8eqeJD/8DRv36A9Eh+90k4DTSxxftw9sAI\n7XH34jmpjt5Cbo+zG5wlD4zwrmlMqMBnPkD5pW30z4fDuLJVdYCstiSu1MQs\nG7PtJgX5sdQl/QGg4x5aHunUtOywEY7QlY/N//C5+udgNrNbHg9NtGDPk/4O\n2q61UVVd0OVWVnFfAi08PvipxYLepVtF2dD499cy2xd/9QSa2P7DFT1rPm0V\nbqIaYDhYefxihotGm9cMeh4bMDhXDPqM46Tws7vj4FLCA7+dHBCBIMcys2A6\nBUXxYR4unorH4PtDaDqbf8UByn8O3d+2FTgciYYcoVvhjSPD4USpR4fDgThn\nJY5GgvYuf7pk5kNWZNnYp9brwCVn5s8Rt0WnQtrC/danRhSKOIyac0i20Auv\ndT54\r\n=v6/c\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIH9A84lHkBqZp7eFTyzrHyd2SQ2J/mr02PoVrXXryhbJAiEAkr8x85mWN6L86lXp/kHfsf09CAhHkJ6Vsjl3wOVTxY4="}],"size":1672,"noattachment":false,"key":"/is-jpg/-/is-jpg-3.0.0.tgz"},"_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"directories":{},"maintainers":[{"name":"sindresorhus","email":"sindresorhus@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/is-jpg_3.0.0_1632039676545_0.9755457171538562"},"_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":1632039676870,"_cnpm_publish_time":1632039676870,"dist-tags":{"latest":"3.0.0"}}