{"name":"stream-file-type","version":"0.3.1","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":"26874d8b952720dac06b86962f7e80fcc74ff124","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.1","_npmVersion":"6.4.1","_nodeVersion":"10.12.0","_npmUser":{"name":"linusu","email":"linus@folkdatorn.se"},"dist":{"integrity":"sha512-qzm5YgwzD4+Wo99fCRjUMbLZ21mj6wR3L8sAJ7fD0B2GHgu8LMHfroIgkxgsS4vMPkxmdS+5dn1kF05DnCrPdg==","shasum":"f6a5961ccf55a82fa858daa3d5f6d2c6f4e79d3b","tarball":"http://registry-npm.ywwl.com/stream-file-type/download/stream-file-type-0.3.1.tgz","fileCount":4,"unpackedSize":3943,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbyEy8CRA9TVsSAnZWagAAg/sQAJWsQv8dPwnFFP8DjDXY\nQUdN/65Bjq6ISBQzV8xTtMBgrxXtHuUvozHvP4aNu2QFJPeLZV5Ksg5FXF+j\nHXdE0iz6KQzk14LUYf7qehWcHfJZ63cV2zHA1j05YWaEnAa5GUMUfrdGJTgc\ncVsDbeUoeKckkfKpGmlv/6pQf2aD8Gkcy7MaUo84+zBU3FKjbxb1/SWGKok0\nctqppx/PYWUFgMQ/bOGKiwbeCdeoV5/JL4s5pgSNWTG+XxyXy/YwS/FC7dvC\nX9E+Rk8kLxHMHKAHw2PyhSfr3cR3Kte8jVJIqMquQknGTBCbw1NY0o8HFL9S\nUDZeUCaZ5J4/YTA/pfvGIYKpgUfQ8kPez53pn1YT+wIAmgUsfUCwMIrEjfoA\ne9IH/XADz51ThfURL00GMhRdL5rVJJUUnXR8VZq9/nSU4hLub51TMD/rGA2X\n7Xp5r/5VtQE+ZAAU1nzSZRQewOko7kqQees3oo9L0Dsqe/yqlzv50kwXsq01\nPp55oYzuU66tVk7RrOtv/vY/0m3FntI6LwjOYHERr8Y2LvGW4S0uivlprG+V\nm4lolDrDUnsv5hO36SZAlbDlJlS0IIUnEcSKLPi1lGIkBzIF4fnoQmL++1VS\nlbdVtfUOyaJXo9pmi5m+9UQDdbHlVHdQ+EZGYaIXD8XEBdfY4viaQsQdd31r\nVs4D\r\n=eN9j\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCE9Fdm+EF5dDwNQ/nKIUDqPiUA9LX6e7/1Fks8+3PoUgIgYzVrid76KVTffA0re49oVVdB1fDb7I7e4iY6+9iNqo4="}],"size":1660,"noattachment":false,"key":"/stream-file-type/-/stream-file-type-0.3.1.tgz"},"maintainers":[{"name":"linusu","email":"linus@folkdatorn.se"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/stream-file-type_0.3.1_1539853499327_0.5479031101099789"},"_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":1539853499513,"_cnpm_publish_time":1539853499513,"dist-tags":{"latest":"0.6.1"}}