{"name":"stream-file-type","version":"0.4.0","license":"MIT","repository":{"type":"git","url":"git+https://github.com/LinusU/stream-file-type.git"},"scripts":{"test":"standard && mocha"},"dependencies":{"file-type":"^12.0.0","readable-stream":"^3.0.6"},"devDependencies":{"hasha":"^3.0.0","mocha":"^5.2.0","standard":"^12.0.1"},"engines":{"node":">=8"},"gitHead":"60965476a4118fde9a293e3d56b03d4b0e94b018","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.4.0","_nodeVersion":"12.12.0","_npmVersion":"6.11.3","dist":{"integrity":"sha512-Nj1pls0XYICU1yWqH1Qi4le/IY8b8vMtW9z4Jk0G/Fd/5p851w/kLXW94Lbv/r4CZA2eXIj4/EHNTaPnUxT8Og==","shasum":"5047d993459b52588b5237e619d5bf57a61964d0","tarball":"http://registry-npm.ywwl.com/stream-file-type/download/stream-file-type-0.4.0.tgz","fileCount":4,"unpackedSize":5781,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdtfytCRA9TVsSAnZWagAAk40P/Am4x29WY3yBQpF4aiQx\nkF1qWcLgmO5r+kKzkHkF5JOWIDeyi7PoEo63rQ/4bBOpu8JYGvD9u+R59PWL\nYgteTGmZYWkYg4C2ghpQt6t3VeijZPGPbGSuxmAUUwgG2L7NRQLxl/+hx+4I\nXgdE/RDaRtRVXtq6s9WprWB55Orm2HCCR4/yFxhEjOHh9HEW1ceilNyY8cjR\nqt+RFMeviT3SkG2oDoCqrcn19tqPZ3FhQnVtwkM8w/h73M3Ad49OSNiUHRKz\n9nTB5K+CHuLwd54sJQanXljVDrNKiCjEfKgfseEU/IP/O8XAf544OjMgTNme\nK7iTggRvmIXzQOgeDxaZFjXxUnBgH6yoYXK2pTNbRV4uFYnKkJksoch13yTY\n38z8TioosKQyoTJa8P8YI6tskAlKVxIcJ/syNeXsj1AjA7TPS6OGCFS9L6eD\nTPlYD05+M5ZyFGufnc/b7/bmPasUuW/1+o8rZuRYFhqFLauKpicifjET8DrR\nKVlSEkL5ez9NiPIBGNRref/qwOmGwJVmejyL2ZE0zHZSOr5sRdh5gFSPJTz2\nU5asyXxknRMMxVmbUfljB0l+ffDD8UHjQFOT950hZKkNxm3LUeabSnQ8L/k2\nvg3XRy+SKGiKkn8Nqm6jfLxwaQqGSwrbRFSfLv+ViS5vJO0PX86CJFf40yE8\nmN8A\r\n=/djr\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIFeat/A4rKzuU9Glt12QuVWlrnvPyc/jUGkJ5212k1d1AiEA/SiLbmsuOex8X7+kQVn5uJyCl2lPASEoEpsLbQFnwe0="}],"size":1878,"noattachment":false,"key":"/stream-file-type/-/stream-file-type-0.4.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.4.0_1572207789021_0.7098492101515241"},"_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":1572207789122,"_cnpm_publish_time":1572207789122,"dist-tags":{"latest":"0.6.1"}}