{"name":"stream-file-type","version":"0.5.0","license":"MIT","repository":{"type":"git","url":"git+https://github.com/LinusU/stream-file-type.git"},"scripts":{"test":"standard && mocha"},"dependencies":{"file-type":"^14.1.4"},"devDependencies":{"hasha":"^5.2.0","mocha":"^7.1.1","standard":"^14.3.3"},"engines":{"node":">=10.13"},"gitHead":"a5601d5382650c6750d24ac47ebf74216d8c1d0e","description":"Get the [file type](https://github.com/sindresorhus/file-type) by inspecting a stream.","bugs":{"url":"https://github.com/LinusU/stream-file-type/issues"},"homepage":"https://github.com/LinusU/stream-file-type#readme","_id":"stream-file-type@0.5.0","_nodeVersion":"12.12.0","_npmVersion":"6.13.6","dist":{"integrity":"sha512-FriHqbS9JnAh+fMB3cPPUeE9B16PKA15VBJVf+3oIcYDlisue7+BQHVQIshFjuNMg2Bx3fd9TL2bTVxTS4cOFA==","shasum":"2ac854721405b03adf03fb734626767caaf5b7b8","tarball":"http://registry-npm.ywwl.com/stream-file-type/download/stream-file-type-0.5.0.tgz","fileCount":4,"unpackedSize":5439,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJee64HCRA9TVsSAnZWagAAWK0QAIczCTsJ9v4LXbjwQtZM\nxtfpIvOSjEV1fvpPQ1wNZasUZyw/tvPB5Hepy4Tc8049Wive6kJLOm2BolcO\nMOs9vBlfMRbSVhSAYAQ1kajvv71rbkwmLbc8MdbuZTsPHNV2pXwXH2XrptAa\nNxEV0v1TyFRh/7MqYvptpGqmUVwQUXAYhAjm13KyTUZLUYnoZG+svMYnRYKK\naQMZfWjA0CMXhsKeJ0DdSv6KjXNwl3Ccdv6aD/iTznz9vMhkpXDaTKmfh/hk\npqjKHOabjDPpHfdlXd4QkW7UjLCl/pUiMgvipzGAXNhWd/20nWPyouI7GL09\n+tpPtfkTmNfXRRtNOp59Xcjqz2cLCZOJs8z1kCxSYeJ2aQZyT12N5fOCfW87\nlCpkT/VO7MRJyLnxm5G4cjQwALLJS/oFOpJAQ3sWrTpQFLlBBmE/GDopD1nq\nJRYmVYBRrNohGNvpCtGdMRN06rhrBjI7T7OXq12wS2wv/kmHcxLIX0mhWAgV\nZcbkptcapxSLwPza3f3Ks4nz9SUxKnw/+bLt03hVF6+pA5dXcFaIptwtEhQa\nCd0i0ms8UFtwdYPcI0TiQPp7f6lQcl9QD96g7WZ7IIEkUqko68zTjwEldbKQ\no+LphXdDtCKf/OJilxMT+vE/UYLn/vUy61qdhMGw80gkAWNOh+NZrGRIQILj\nTXVv\r\n=nnq2\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQC0r2tV4oxYClyS554aIeqwnxKJf+2ET4nucLnis2m/ZgIgbvrnnX61eJpqLI92OxPUlt8rTqNLlfuCOzcqEkKapIM="}],"size":1728,"noattachment":false,"key":"/stream-file-type/-/stream-file-type-0.5.0.tgz"},"maintainers":[{"name":"linusu","email":"linus@folkdatorn.se"}],"_npmUser":{"name":"linusu","email":"linus@folkdatorn.se"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/stream-file-type_0.5.0_1585163783041_0.9746144919377397"},"_hasShrinkwrap":false,"readme":"# Stream File Type\n\nGet the [file type](https://github.com/sindresorhus/file-type) by inspecting a stream.\n\n## Usage\n\n```js\nimport fs from 'node:fs'\nimport FileType from 'stream-file-type'\n\nconst input = fs.createReadStream('cat.jpg')\nconst detector = new FileType()\n\n// Listen for event...\ndetector.on('file-type', (fileType) => {\n  if (fileType === null) {\n    console.log(`The mime type of \"cat.jpg\" could not be determined`)\n  } else {\n    console.log(`The file \"cat.jpg\" has the \"${fileType.mime}\" mime type`)\n  }\n})\n\n// ...or get a Promise\ndetector.fileTypePromise().then((fileType) => {\n  if (fileType === null) {\n    console.log(`The mime type of \"cat.jpg\" could not be determined`)\n  } else {\n    console.log(`The file \"cat.jpg\" has the \"${fileType.mime}\" mime type`)\n  }\n})\n\ninput.pipe(detector).resume()\n```\n\n## API\n\n### `new FileType() => DuplexStream`\n\nReturns a new `DuplexStream` that will detect the file type of the content passing thru. All the data is passed as-is right thru the stream, and can be further piped to another destination.\n\nWhen enough bytes have come thru to determine the file type (currently 4100) the event `file-type` will be emitted with the result of the detection. The result will either be `null` or an object with `ext` and `mime`.\n\n- `ext` - One of the [supported file types](https://github.com/sindresorhus/file-type#supported-file-types)\n- `mime` - The [MIME type](http://en.wikipedia.org/wiki/Internet_media_type)\n\n### `FileType#fileTypePromise() => Promise`\n\nReturns a `Promise` of the detected file type. If the `file-type` event has already been emitted, the promise will be resolved with the result, otherwise the promise will be resolved when the file-type is detected.\n","publish_time":1585163783157,"_cnpm_publish_time":1585163783157,"dist-tags":{"latest":"0.6.1"}}