Skip to content

Commit

Permalink
Update readme.md
Browse files Browse the repository at this point in the history
  • Loading branch information
sindresorhus authored Jul 12, 2021
1 parent d3b2543 commit 8f2886d
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -282,13 +282,11 @@ A file source implementing the [tokenizer interface](https://github.com/Borewit/

Detect the file type of a readable stream.

If `sampleSize` is not provided, a backward compatible sample size of 4100 bytes is used.
If `sampleSize` is not provided, a backward-compatible sample size of 4100 bytes is used.

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 `FileType.fromFile()`.

Very handy to put in between a stream, but it comes with a price.
Internally `stream()` builds up a buffer of `sampleSize` bytes, used as a sample, to determine the file type.
The sample size impacts the file detection resolution. A smaller sample size will result in lower probability of the best file type detection.
Very handy to put in between a stream, but it comes with a price. Internally `stream()` builds up a buffer of `sampleSize` bytes, used as a sample, to determine the file type. 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 using Node.js.

Expand Down

0 comments on commit 8f2886d

Please sign in to comment.