-
-
Notifications
You must be signed in to change notification settings - Fork 356
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
unshift stream support #452
Comments
I think you mean that the concept of a stream has been misunderstood in other issues. At the same time, I do understand the desire to peek ahead on stream, determine the right file type from the stream, and read from the stream as if nothing happened. For that use case Related:
Writing the file first sounds like a reasonable solution to me. You simply do not know how much of the file you need to determine it's file type. The fact that we can determine the file type for many files with the very first few bytes, does not take away the fact that for some files we need much more data. |
Related to #399. |
A few issues have pointed out that the stream becomes broken\altered after to fromStream is called.
its a pretty serious side effect that wouldn't be obvious at all.
we are currently working around this issue by calling stream.read(xxxx) and then stream.unshift. Maybe unshift could be an argument to stream.read() ... or maybe the chunk read could be passed back.
For us we get a stream from the http request, want to detect file type, but then immediately need to pass the stream to AWS's s3 sdk ... bit weird and we could probably just write the file, but unshift seems to work for now.
The text was updated successfully, but these errors were encountered: