{"_id":"stream-file-type","_rev":"387055","name":"stream-file-type","description":"Get the [file type](https://github.com/sindresorhus/file-type) by inspecting a stream.","dist-tags":{"latest":"0.6.1"},"maintainers":[{"name":"linusu","email":""}],"time":{"modified":"2021-08-04T03:31:17.000Z","created":"2017-01-25T20:31:32.331Z","0.6.1":"2021-07-24T16:05:36.405Z","0.6.0":"2021-07-24T14:54:57.675Z","0.5.0":"2020-03-25T19:16:23.157Z","0.4.0":"2019-10-27T20:23:09.122Z","0.3.2":"2018-10-18T09:29:32.596Z","0.3.1":"2018-10-18T09:04:59.513Z","0.3.0":"2018-10-18T08:32:43.294Z","0.2.0":"2018-10-18T07:16:18.563Z","0.1.1":"2017-01-25T21:24:53.897Z","0.1.0":"2017-01-25T20:31:32.331Z"},"users":{},"repository":{"type":"git","url":"git+https://github.com/LinusU/stream-file-type.git"},"versions":{"0.6.1":{"name":"stream-file-type","version":"0.6.1","license":"MIT","repository":{"type":"git","url":"git+https://github.com/LinusU/stream-file-type.git"},"type":"module","exports":"./index.js","scripts":{"test":"standard && mocha"},"dependencies":{"file-type":"^16.0.0"},"devDependencies":{"hasha":"^5.2.2","mocha":"^9.0.2","standard":"^16.0.3"},"engines":{"node":"^12.20.0 || ^14.13.1 || >=16.0.0"},"gitHead":"ead179f7e1be04974c29bf605a76831c07ce3cf8","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.6.1","_nodeVersion":"16.5.0","_npmVersion":"7.19.1","dist":{"shasum":"d8b8ac8736a0f2df7ca3e5718e28b6e8187f78fe","size":1723,"noattachment":false,"key":"/stream-file-type/-/stream-file-type-0.6.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/stream-file-type/download/stream-file-type-0.6.1.tgz"},"_npmUser":{"name":"linusu","email":"linus@folkdatorn.se"},"directories":{},"maintainers":[{"name":"linusu","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/stream-file-type_0.6.1_1627142736247_0.01686400858588155"},"_hasShrinkwrap":false,"publish_time":1627142736405,"_cnpm_publish_time":1627142736405},"0.6.0":{"name":"stream-file-type","version":"0.6.0","license":"MIT","repository":{"type":"git","url":"git+https://github.com/LinusU/stream-file-type.git"},"type":"module","exports":"./index.js","scripts":{"test":"standard && mocha"},"dependencies":{"file-type":"^16.0.0"},"devDependencies":{"hasha":"^5.2.2","mocha":"^9.0.2","standard":"^16.0.3"},"engines":{"node":"^12.20.0 || ^14.13.1 || >=16.0.0"},"gitHead":"8f610f54f25c1673c7f0c4f0febff227b765f442","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.6.0","_nodeVersion":"16.5.0","_npmVersion":"7.19.1","dist":{"shasum":"401a8417a7767341321d394969e8b159cf1b989e","size":1723,"noattachment":false,"key":"/stream-file-type/-/stream-file-type-0.6.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/stream-file-type/download/stream-file-type-0.6.0.tgz"},"_npmUser":{"name":"linusu","email":"linus@folkdatorn.se"},"directories":{},"maintainers":[{"name":"linusu","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/stream-file-type_0.6.0_1627138497508_0.9859632242777467"},"_hasShrinkwrap":false,"publish_time":1627138497675,"_cnpm_publish_time":1627138497675},"0.5.0":{"name":"stream-file-type","version":"0.5.0","license":"MIT","repository":{"type":"git","url":"git+https://github.com/LinusU/stream-file-type.git"},"scripts":{"test":"standard && mocha"},"dependencies":{"file-type":"^14.1.4"},"devDependencies":{"hasha":"^5.2.0","mocha":"^7.1.1","standard":"^14.3.3"},"engines":{"node":">=10.13"},"gitHead":"a5601d5382650c6750d24ac47ebf74216d8c1d0e","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.5.0","_nodeVersion":"12.12.0","_npmVersion":"6.13.6","dist":{"shasum":"2ac854721405b03adf03fb734626767caaf5b7b8","size":1728,"noattachment":false,"key":"/stream-file-type/-/stream-file-type-0.5.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/stream-file-type/download/stream-file-type-0.5.0.tgz"},"maintainers":[{"name":"linusu","email":""}],"_npmUser":{"name":"linusu","email":"linus@folkdatorn.se"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/stream-file-type_0.5.0_1585163783041_0.9746144919377397"},"_hasShrinkwrap":false,"publish_time":1585163783157,"_cnpm_publish_time":1585163783157},"0.4.0":{"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":{"shasum":"5047d993459b52588b5237e619d5bf57a61964d0","size":1878,"noattachment":false,"key":"/stream-file-type/-/stream-file-type-0.4.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/stream-file-type/download/stream-file-type-0.4.0.tgz"},"maintainers":[{"name":"linusu","email":""}],"_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,"publish_time":1572207789122,"_cnpm_publish_time":1572207789122},"0.3.2":{"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":{"shasum":"a00ce0b2772d1b543e5a25d2fe12f3d041bacebb","size":1865,"noattachment":false,"key":"/stream-file-type/-/stream-file-type-0.3.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/stream-file-type/download/stream-file-type-0.3.2.tgz"},"maintainers":[{"name":"linusu","email":""}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/stream-file-type_0.3.2_1539854972466_0.6744727743440362"},"_hasShrinkwrap":false,"publish_time":1539854972596,"_cnpm_publish_time":1539854972596},"0.3.1":{"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":{"shasum":"f6a5961ccf55a82fa858daa3d5f6d2c6f4e79d3b","size":1660,"noattachment":false,"key":"/stream-file-type/-/stream-file-type-0.3.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/stream-file-type/download/stream-file-type-0.3.1.tgz"},"maintainers":[{"name":"linusu","email":""}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/stream-file-type_0.3.1_1539853499327_0.5479031101099789"},"_hasShrinkwrap":false,"publish_time":1539853499513,"_cnpm_publish_time":1539853499513},"0.3.0":{"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":{"shasum":"45d25b363f779ef9347a073aaeb227760ee4db96","size":23832,"noattachment":false,"key":"/stream-file-type/-/stream-file-type-0.3.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/stream-file-type/download/stream-file-type-0.3.0.tgz"},"maintainers":[{"name":"linusu","email":""}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/stream-file-type_0.3.0_1539851563135_0.7032633927277505"},"_hasShrinkwrap":false,"publish_time":1539851563294,"_cnpm_publish_time":1539851563294},"0.2.0":{"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":{"shasum":"4d77138e087190aac205b2600ce39d6b799dda62","size":23829,"noattachment":false,"key":"/stream-file-type/-/stream-file-type-0.2.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/stream-file-type/download/stream-file-type-0.2.0.tgz"},"maintainers":[{"name":"linusu","email":""}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/stream-file-type_0.2.0_1539846978455_0.672725963744708"},"_hasShrinkwrap":false,"publish_time":1539846978563,"_cnpm_publish_time":1539846978563},"0.1.1":{"name":"stream-file-type","version":"0.1.1","license":"MIT","repository":{"type":"git","url":"git+https://github.com/linusu/stream-file-type.git"},"scripts":{"test":"standard && mocha"},"dependencies":{"file-type":"^4.1.0","readable-stream":"^2.2.2"},"devDependencies":{"hasha":"^2.2.0","mocha":"^3.2.0","standard":"^8.6.0"},"gitHead":"7d47f7b6cc7c2096c0c2a022122dbd1238d4f41b","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.1.1","_shasum":"a4ac1a01a0ac4df39673b08908846f4cf27a15e7","_from":".","_npmVersion":"4.0.5","_nodeVersion":"7.4.0","_npmUser":{"name":"linusu","email":"linus@folkdatorn.se"},"dist":{"shasum":"a4ac1a01a0ac4df39673b08908846f4cf27a15e7","size":35444,"noattachment":false,"key":"/stream-file-type/-/stream-file-type-0.1.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/stream-file-type/download/stream-file-type-0.1.1.tgz"},"maintainers":[{"name":"linusu","email":""}],"_npmOperationalInternal":{"host":"packages-18-east.internal.npmjs.com","tmp":"tmp/stream-file-type-0.1.1.tgz_1485379493362_0.15990527207031846"},"directories":{},"publish_time":1485379493897,"_cnpm_publish_time":1485379493897,"_hasShrinkwrap":false},"0.1.0":{"name":"stream-file-type","version":"0.1.0","license":"MIT","repository":{"type":"git","url":"git+https://github.com/linusu/stream-file-type.git"},"scripts":{"test":"standard && mocha"},"dependencies":{"file-type":"^4.1.0","readable-stream":"^2.2.2"},"devDependencies":{"hasha":"^2.2.0","mocha":"^3.2.0","standard":"^8.6.0"},"gitHead":"b38ab8453de341cf7c2ff5e58f307418a2e61611","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.1.0","_shasum":"ab0f118b6567b0d3ddbb725db20e2e30b681e46c","_from":".","_npmVersion":"4.0.5","_nodeVersion":"7.4.0","_npmUser":{"name":"linusu","email":"linus@folkdatorn.se"},"dist":{"shasum":"ab0f118b6567b0d3ddbb725db20e2e30b681e46c","size":35382,"noattachment":false,"key":"/stream-file-type/-/stream-file-type-0.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/stream-file-type/download/stream-file-type-0.1.0.tgz"},"maintainers":[{"name":"linusu","email":""}],"_npmOperationalInternal":{"host":"packages-18-east.internal.npmjs.com","tmp":"tmp/stream-file-type-0.1.0.tgz_1485376291776_0.19189019477926195"},"directories":{},"publish_time":1485376292331,"_cnpm_publish_time":1485376292331,"_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","_attachments":{},"homepage":"https://github.com/LinusU/stream-file-type#readme","bugs":{"url":"https://github.com/LinusU/stream-file-type/issues"},"license":"MIT"}