{"name":"stream-file-type","version":"0.3.0","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":"5e693d53979de14e6c0326b152019de9a0b790c5","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.0","_npmVersion":"6.4.1","_nodeVersion":"10.12.0","_npmUser":{"name":"linusu","email":"linus@folkdatorn.se"},"dist":{"integrity":"sha512-BLYNVXYxXSi0Y5+m4IQb0KY7AbEiGYg8TZP4jBtrCFqZ81YQ9zH/MqQDNJxecaotm1xy8UIfi6dh9sdBrNbhJw==","shasum":"45d25b363f779ef9347a073aaeb227760ee4db96","tarball":"http://registry-npm.ywwl.com/stream-file-type/download/stream-file-type-0.3.0.tgz","fileCount":6,"unpackedSize":26286,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbyEUrCRA9TVsSAnZWagAAVokP/RhbhWnxg3UjZWq9vmbM\nvvI7OGP8qxN7hIyXY1iG9ZXEVgPNiNWyKOkQG7YfFkTo+86HR+yWsVvawwIE\nsip/nO0nUyYhZN49WZ3SWJyGtSY7B6y55fUuTSNyxOexmCrnX1uNHdmaATSq\nGU6jkmQ4epBFcjMupusKIuwT6xYfxYMYYRQahqUrnaddASqwG2ZIGOiUTRrA\nw504cV8U9QaXs/YVApbrtj/y3QaF31lF9IP1BwGRw+H6FLHpVwxFwC2GSjr2\nqwmYYeFJsiRwU216v7PZ3OfeeZG9dPOoP2UGuNiaxQRfCwn5GNUPWv0pGrO0\n40+ca3aV8juMiQgYNKNpfDlYC3NyMjuJrYi2kWNEImOVDtK7Kf7rRmh6Upnu\naQd+w0rMwwosISS7fpFgrC3aiwWw99ypHrGyvgcBMQgsexk9+s95bZPzPPET\na4ccpRrJYh6E9NhevlDCJhmqcOhKyzk1SSF5VuKJZ2tylYklV3OFiV3/9aVg\nIeIW88Nn0Hd+Gtw2XfIA+03FK/PESCDm3N1a2pmEpIW6dhzNaqKvHo+h0Vsl\nes5TW41kDKTHZpNS1LSuXOE2PC0S0w6Pv/o6GOk/fYVZNER17FsABcl2C8qx\nJRy0S4u1RYVlYlx2xjobDlMG2KIec54CQR/tZGtDwKmrZ3aRT5qAqnvL2ZD5\nm2hq\r\n=qkRT\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCVPDp9R/jXrbRzYq2/qbARvv8NAGyA/n+NvFOngr6uoQIgUSjKZf0/MX3KfD04/mC8MwcZcnhXOszbP2uIdUmt89Y="}],"size":23832,"noattachment":false,"key":"/stream-file-type/-/stream-file-type-0.3.0.tgz"},"maintainers":[{"name":"linusu","email":"linus@folkdatorn.se"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/stream-file-type_0.3.0_1539851563135_0.7032633927277505"},"_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":1539851563294,"_cnpm_publish_time":1539851563294,"dist-tags":{"latest":"0.6.1"}}