Closed Zipdox2 closed 1 year ago
createObjectURL
itself is not recommended as it's leaky, probably we should get a proper download API that receives Response object: https://github.com/whatwg/html/issues/4148. For other use cases, see https://github.com/whatwg/fetch/issues/49.
Closing this as per @saschanaz reply.
I believe allowing the creation of object URLs for ReadableStreams would be very useful. Especially since some browsers don't implement the File System Access API for security.
Creating object URLs for ReadableStreams would allow for example progressive downloads of large client generates files. Currently doing this requires a hack using service workers, but these are not usable in private mode.
It could also be used to progressively load images from a stream this way, although maybe this is less practical to implemented and less useful.
It probably isn't that useful to play videos from streams like this as the MediaSource object already exists for that.
Implementing object URLs for streams might be more difficult than for static objects, but it was done for MediaSource before, so it should be possible in a similar fashion. I propose that creating an object URL for a stream locks the stream in the same way creating a reader does.