KristofferStrube / Blazor.FileSystemAccess

A Blazor wrapper for the File System Access browser API.
https://kristofferstrube.github.io/Blazor.FileSystemAccess/
MIT License
327 stars 39 forks source link

Feature: Stream read Blobs #22

Closed KristofferStrube closed 1 year ago

KristofferStrube commented 2 years ago

In Version 1.1.0 we added that FileSystemWritableFileStream extends Stream so that we could easily stream write to that. I would like the same for Blob so that we easily stream read from that.

We have had some discussion on this in issue #19 already but I wanted to have this issue to track this feature independently.

If we look at the specifications of a Blob we can see that it has a stream method. So a part of this issue is to explore what a stream in JS is and which similarities it has with Stream from .NET.

A consideration we had in the other discussion was whether or not this work on wrapping JS Blob should actually live in this repo. If we were to split that out and take a dependency on it then others could potentially also utilize it without depending on this repo.

KristofferStrube commented 2 years ago

Found this: https://streams.spec.whatwg.org/#readablestream Something to look at that is especially interesting is the pipeTo method which seems very parallel to CopyTo from .NET.

KristofferStrube commented 2 years ago

I think the goal for Release 1.3.0 should be to support streaming for blobs, but moving the whole of the File API wrapping into its own library and repository. Unless more pressing or needed features should emerge before the ending of the month.

KristofferStrube commented 1 year ago

This was fixed as a part of #28 and has been published in version 2.0.0 to NuGet.

We can now get the ReadableStream from a Blob. The ReadableStream extends .NET Stream class and has enabled reading without seeking.