-
-
Notifications
You must be signed in to change notification settings - Fork 343
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add .stream()
method
#187
Add .stream()
method
#187
Conversation
Travis is failing |
.stream()
method
Interesting. Will look into it. |
Piping the This does require that we import the The open question then becomes, how do we want to keep this browser compatible? The stream method nor the require should be used in browsers. |
Agreed
Webpack is super annoying in this sense and tries to import every require, even if it's behind an if-statement or not even used. One way to work around this is to use module.exports.stream = () => {
const stream = eval('require')('stream');
// …
}; |
Bug found on the https://github.com/bencmbrook/file-type/blob/929de6c441bc9b0c2cb6642f15a3d239ee7d6470/index.js#L928 |
Features are done and tests are all passing. Anything you want changed in the latest commits? |
Marked everything as resolved |
🤙sweet. I'm gonna get a lot of use out of this. Also, minor docs error on that readme commit: e8d4e1f#r32592498 |
PassThrough causes issues with rewind for me: #216 |
How so? What version of file-type are you using? |
This PR adds a method to support Node streams without causing side effects on the state of the stream. It reads in the minimum amount of bytes to detect the filetype, detects the file type, then rolls back the stream for use elsewhere.
Fixes #186