{"name":"stream-file-type","version":"0.3.2","license":"MIT","repository":{"type":"git","url":"git+https://github.com/LinusU/stream-file-type.git"},"scripts":{"test":"standard && mocha"},"dependencies":{"file-type":"^10.0.0","readable-stream":"^3.0.6"},"devDependencies":{"hasha":"^3.0.0","mocha":"^5.2.0","standard":"^12.0.1"},"engines":{"node":">=6"},"gitHead":"7dce11d1e7a4957370726d369cb6d3aedc5194e2","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.3.2","_npmVersion":"6.4.1","_nodeVersion":"10.12.0","_npmUser":{"name":"linusu","email":"linus@folkdatorn.se"},"dist":{"integrity":"sha512-XJ+nuJj9jW79NwA76UE/r69r9tAdPKKFl1NaURtnpb39Znj5ZBzCXvpIav0N00myHhTziQRG5fXwQKB/9zR3lA==","shasum":"a00ce0b2772d1b543e5a25d2fe12f3d041bacebb","tarball":"http://registry-npm.ywwl.com/stream-file-type/download/stream-file-type-0.3.2.tgz","fileCount":4,"unpackedSize":5773,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbyFJ9CRA9TVsSAnZWagAAa0wP/1AXdgcOZtmYSnWCSbIe\nxs5hMefMQoGkyaKIOM5QrY4aMlHfW1FxMZiahogQpxZlfnu8jCKaCE073z/w\nDdMgy57U51PpQ0NdupJsw3eToXAMIClOZNrXiTTUrgaxSAfkbqnU79udauhP\nN+LB+YTGJR7EItX2wyTaY+IIEnL5pA0qXOsZGEZ1znzm/d7wuWnrlJDDkieE\nl0ggNFf+8P/nDgmIn9DZsxY5t97/Nn39Z8rO3eQELLXx9aYyU/r0FxlE2cAK\nEEFkM7v+OV40WD3KniGHSxlwdfGqu4L2foY6mX4/KnvegTbyvqUPqPEqJYsy\n6VPmtojyxi0ksxWtXB3OiRxR+8Ws+vMy0Y48IFLw/QGQyF0XYXhDw6nyADMJ\nYfkhQ9ZzDTl7DdoXf3xNq/ozHN5HONG+x1hYM7hv3p6Jh2B7OXASZ0+EeSY+\nQTaIc7NckpU/0j2Hh4adndc7lOkcMmRvr/4DiAt6at/Ews150fPS7kjUit2q\ng2DAH8wiQUPtZNYxJ0WjsmRv8ROCuWQxizmmzKtmwnj8pIqF3NYm5GCHasPS\nTxhHH/48bY40zXSqxMEAfyrVHqTkUzBxOp2SvOb7AndIzPO5PDSoY+NK7M3Q\nRTnYW63EkPd3fmF6FpFf8QAbfckwY25VJTlhd6u7m7XU1Nh0dWe/2ngk4BEO\nUo4d\r\n=9m1t\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDcbqBLzTYOvUgOaCepo6Cxq5LcFj/B27MwrDMEtNA+9QIhAITK4K2Y2SrtinZxKvsb2EWA+kJff2aVUYey9HJggX80"}],"size":1865,"noattachment":false,"key":"/stream-file-type/-/stream-file-type-0.3.2.tgz"},"maintainers":[{"name":"linusu","email":"linus@folkdatorn.se"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/stream-file-type_0.3.2_1539854972466_0.6744727743440362"},"_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":1539854972596,"_cnpm_publish_time":1539854972596,"dist-tags":{"latest":"0.6.1"}}