-
Notifications
You must be signed in to change notification settings - Fork 29.4k
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 async Blob sources #37338
Labels
buffer
Issues and PRs related to the buffer subsystem.
Comments
This was referenced Feb 12, 2021
This was referenced May 15, 2021
wondering if this can be closed now...? const blob = new Blob([ other_blob_parts ])
const url = url.createObjectURL(blob)
new Worker(url) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The terminology "async Blob source" was mention earlier[1] I think it means in chromes world a "BlobDataItem"
blobA
andblobB
it should still only be 20.000 bytesblobB
should be a reference toblobA
with another offset from 0 to 10_000 and shouldn't allocate any new bufferAnd if we create a 3rd blob
blobC = new Blob([blobB, blobB])
blobC
will just have two reference to blobB (witch actually refers to two slices of blobA). And reading this blobC will be like if we created two readable streams and read them one after the otherblobC.stream() === [blobB.stream(), blobB.stream()]
in this case both
blobB
andBlobC
would not have any underlying source that holds the data in memory. this would only be (nested) references to blobAGuess this is some important steps towards solving async blob sources and mixing both blobs that could come from the
fs
and mixed with blobs constructed with data from the memoryI created something like this async sources in fetch-blob and also a kind of BlobDataItem that was backed up by the filesystem and didn't hold anything in the memory. I have totally manage to solve this slicing stuff in a synchronous way and also constructing new blobs with other parts. the only thing that is async is how it reads the data. My blob is constructed with a sequence of blob parts (with offsets of other parts) (not a single source like a full ArrayBuffer containing all data).
That is how it can manage to take any other instance of a Blob class that isn't our own and knowing nothing about the internal source of the other blob. So you can construct fetch-blob with something that looks and behaves like any other Blob. it could for instance accept a BlobDataItem from the
fs
and alsobuffer.Blob
note that a blob from fs should keep track of last modified time and if it isn't the same when you are reading, then the internal stream should throw a error
The text was updated successfully, but these errors were encountered: