{"name":"stream-file-type","version":"0.2.0","license":"MIT","repository":{"type":"git","url":"git+https://github.com/LinusU/stream-file-type.git"},"scripts":{"test":"standard && mocha"},"dependencies":{"file-type":"^7.7.1","readable-stream":"^2.2.2"},"devDependencies":{"hasha":"^2.2.0","mocha":"^5.2.0","standard":"^12.0.1"},"gitHead":"2f0ccbcadcd05fcff21cc737224008a83f566f6d","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.2.0","_npmVersion":"6.4.1","_nodeVersion":"10.12.0","_npmUser":{"name":"linusu","email":"linus@folkdatorn.se"},"dist":{"integrity":"sha512-AmYmqNwK5InDMA41vgRvKAyQ//4Ru4T2oJY5rR2COPCczDJIEP0gGAuXFFQJsiyQlCHKHmtPMnWy+/s/sB/SEQ==","shasum":"4d77138e087190aac205b2600ce39d6b799dda62","tarball":"http://registry-npm.ywwl.com/stream-file-type/download/stream-file-type-0.2.0.tgz","fileCount":6,"unpackedSize":26281,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbyDNDCRA9TVsSAnZWagAA8lQQAJW6rxjz8MYe3wja8gWB\nf89xozdL31hzVOYLWlJshTsZBOXAUL6dhR7zOQqVZXQ2w9WmRvMIfvMoVUZg\nKPR6yhF9TnmgXwetBpYO35EZ30APsyKThU7koMG557zpkTwVFQAvGnxm+hb4\ntKc+bSLxNxXElM8SROhngt6BSMFG4qoTn8Yg54gXi85l9GcNZ/wLSxFG/DYo\neAfS9wQmF+HUnP/ELTEccrMRQbWkdl5CXkVL4EqW5miVEUYhpEagvGaSel/s\nuzksmRn2ANFaUqPqqdFx8KQKfXp3EAsnpZggHomImDIn1Q2Dcd6ByDSWOIAW\nZWa1/DaGVr3ufc9QfbKxptI2qZke0d4TkwIlfBSfrbzI/7NwZeV/bdII41LM\nt2FifhKDz1KpHli/93BsXK5wt2vPjRsKk4/oF6sapz4Kj0useIrCQvS4GGq0\nmqFU+qtDbeddT9pC+9wKs3V3ascN4EVR2eUgmHqmNY+iFD/T7n0XylMakAfh\nStH+0OvnpFDE78BAYMPmk2ELXh8t6Z4jdTtTOXpKy2IY4ezw69unoMJDBLEJ\nxEFY3w5hS1gakZWixCya53qMeoNnSR6NfBoB0745iY7ohWANuygbKegSKwah\nfq0XMzmOOof4/p2tG+/duCrrE2Bjm6lvL6ii8MsGyxzAK4/ePiz4M+tX+V9t\nT90l\r\n=BOb6\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDOKdI88YJNiDwr0MOWXIvH320/Wv9RWQMXjbZZzVjrvgIhAMSgI+jEtkWSHtVkH6KwQ3FcNtKxPooLW34QCTRmRKnt"}],"size":23829,"noattachment":false,"key":"/stream-file-type/-/stream-file-type-0.2.0.tgz"},"maintainers":[{"name":"linusu","email":"linus@folkdatorn.se"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/stream-file-type_0.2.0_1539846978455_0.672725963744708"},"_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":1539846978563,"_cnpm_publish_time":1539846978563,"dist-tags":{"latest":"0.6.1"}}