-
Notifications
You must be signed in to change notification settings - Fork 8
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
Missing Blob/File stream methods #8
Comments
Thanks for the good work! Looks like this already has been implemented - any chance to get it released? I'm using the unpkg hosted version at https://unpkg.com/@stardazed/streams-polyfill/dist/sd-streams-polyfill.min.js and there Blob is unpatched on FF |
I made a test implementation indeed, but there's a fundamental problem where this will not just work as a simple method polyfill. Without resorting to terrible page scanning and other hackery there is for example no way to get a patched There were some other issues as well but it's been a while but for me not being able to just use a Also I can't remember how well I tested the Blob modification. I will have to look back at it, but schedule for that is currently undetermined. |
Thanks for your response, @zenmumbler! I look forward to it, if something comes once :) I would like to compress blobs in this way: blob.stream().pipeThrough(new CompressionStream('gzip')) which is not yet polyfillable. I use this stupid patch to work around the problem for the time being: export class PatchableReadableStream extends ReadableStream {
constructor (reader) {
super({
async start(controller) {
while (true) {
const { done, value } = await reader.read()
if (done) break
controller.enqueue(value)
}
controller.close()
reader.releaseLock()
}
})
}
}
const readableStream = new PatchableReadableStream(blob.stream().getReader())
readableStream.pipeThrough(new CompressionStream('gzip')) Not pretty, but works. |
This polyfill works great for streaming
fetch
es, but it doesn't patch theReadableStream
implementation ofBlob
(and by extension,File
).The following returns a function in Chrome but not in Firefox when using the polyfill:
x=new Blob().stream().pipeThrough
The text was updated successfully, but these errors were encountered: