diff --git a/index.js b/index.js index ecebcaad..56dd18af 100644 --- a/index.js +++ b/index.js @@ -70,7 +70,7 @@ export async function fileTypeFromStream(stream, fileTypeOptions) { } export async function fileTypeStream(readableStream, options = {}) { - return new NodeFileTypeParser().toDetectionStream(readableStream, options); + return new NodeFileTypeParser(options).toDetectionStream(readableStream, options); } export {fileTypeFromTokenizer, fileTypeFromBuffer, fileTypeFromBlob, FileTypeParser, supportedMimeTypes, supportedExtensions} from './core.js'; diff --git a/readme.md b/readme.md index 82da982a..af5bd71b 100644 --- a/readme.md +++ b/readme.md @@ -265,7 +265,7 @@ Type: [`ITokenizer`](https://github.com/Borewit/strtok3#tokenizer) A file source implementing the [tokenizer interface](https://github.com/Borewit/strtok3#tokenizer). -### fileTypeStream(readableStream, options?) +### fileTypeStream(webStream, options?) Returns a `Promise` which resolves to the original readable stream argument, but with an added `fileType` property, which is an object like the one returned from `fileTypeFromFile()`. @@ -274,8 +274,7 @@ Internally `stream()` builds up a buffer of `sampleSize` bytes, used as a sample The sample size impacts the file detection resolution. A smaller sample size will result in lower probability of the best file type detection. -**Note:** This method is only available when using Node.js. -**Note:** Requires Node.js 14 or later. +**Note:** When using Node.js, a `stream.Readable` may be provided as well. #### readableStream