Skip to content

Commit bd3b5a4

Browse files
Fix options in combination with fileTypeStream() (#650)
Co-authored-by: Sindre Sorhus <sindresorhus@gmail.com>
1 parent 7bf1120 commit bd3b5a4

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ export async function fileTypeFromStream(stream, fileTypeOptions) {
7070
}
7171

7272
export async function fileTypeStream(readableStream, options = {}) {
73-
return new NodeFileTypeParser().toDetectionStream(readableStream, options);
73+
return new NodeFileTypeParser(options).toDetectionStream(readableStream, options);
7474
}
7575

7676
export {fileTypeFromTokenizer, fileTypeFromBuffer, fileTypeFromBlob, FileTypeParser, supportedMimeTypes, supportedExtensions} from './core.js';

readme.md

+2-3
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ Type: [`ITokenizer`](https://github.com/Borewit/strtok3#tokenizer)
265265

266266
A file source implementing the [tokenizer interface](https://github.com/Borewit/strtok3#tokenizer).
267267

268-
### fileTypeStream(readableStream, options?)
268+
### fileTypeStream(webStream, options?)
269269

270270
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()`.
271271

@@ -274,8 +274,7 @@ Internally `stream()` builds up a buffer of `sampleSize` bytes, used as a sample
274274
The sample size impacts the file detection resolution.
275275
A smaller sample size will result in lower probability of the best file type detection.
276276

277-
**Note:** This method is only available when using Node.js.
278-
**Note:** Requires Node.js 14 or later.
277+
**Note:** When using Node.js, a `stream.Readable` may be provided as well.
279278

280279
#### readableStream
281280

0 commit comments

Comments
 (0)