{"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","tarball":"http://registry-npm.ywwl.com/is-jpg/download/is-jpg-1.0.1.tgz","fileCount":4,"unpackedSize":2931,"integrity":"sha512-X5PVpLMBH/OaeTN8quzbcLTlwXCb/6n3tcfYTtEDzp0ZwAlgAOtIAIBHN4mS5OcscMgO8etZ5Ol1mNrXSqwBVQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCID+6IC/uHOLJhlCyrHkuWO/VKhN0MYMV/RO0xurLbi9eAiEAjj2qn8QXVQVGNrpYfcWneeoS2rJeEIeR+oFeIN2HtB4="}],"size":1727,"noattachment":false,"key":"/is-jpg/-/is-jpg-1.0.1.tgz"},"maintainers":[{"name":"sindresorhus","email":"sindresorhus@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/is-jpg_1.0.1_1521733408058_0.5738571946469975"},"_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":1521733408099,"_cnpm_publish_time":1521733408099,"dist-tags":{"latest":"3.0.0"}}