-
-
Notifications
You must be signed in to change notification settings - Fork 370
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
Support for reading from Blob in Node.js #588
Conversation
6060190
to
0b8296b
Compare
@Borewit Thanks. Maybe we can get rid of |
The current implementation The fact that it implemented as an adapter makes it unsuitable at the moment to be moved into core. Only when we are able utilize the Node.js ReadableStream it does make sense to move it into core. And actually only when this could be used to process both the which should be in theory the same streams WHATWG streams, but are in reality, not necessary interchangeable:
Caveat on the file-type Blob function The way the implementation is, and was, inconsistent with the other function, as it does not utilize the lazy reading we use with streams. As it converts the Blob to a buffer, use cases where a Blob (File) is still stream (like when you upload a file), the current mechanism will read the entire Blob (File) in memory. Related to the previous discussion, utilizing the Blob.stream() this could be prevented. At the other hand, the user can do this as well, and provide that to the WHATWG stream read function we just discussed. |
if the hole file dose not need to be read in order to get magic numbers (head and footer) head = blob.slice(0, 1024)
footer = blob.slice(-1024) you could also make a really small blob out of it: Also worth mentioning that there now also is a |
Support for reading from Blob in Node.js context.
Resolves: #581
First merge: