Tewr/BlazorFileReader

Request: Can you also make this "Write" files via a chunking mechanism ?

Smurf-IV opened this issue · 3 comments

Usage Scenarios:

  • Blazor App generates large data set
  • Blazor App downloads large file (streams) via chunks (e.g. gRPC streaming call)

Expected:

  • User to select target file with provided extension (e.g. SaveAs with *.pdf set)
  • File is created (errors returned etc if not possible) and a writeable stream created
  • Data transferred to via byte[] (Or stream.WriteTo)
  • Commit / Close called with errors returned due to Flush etc not completing.
  • No memory used to store the file with js as the file builds up (i.e. if 1GB file, then only expect to have small memory buffer - if at all- in use)

Call the project BlazorFileWriter or convert this into a joint project that does both sides e.g. BlazorFileHandler

Tewr commented

In essence, the core of this project is a wrapper around the JavaScript FileReader. The FileReader js API is mature and well supported.

I do think this is interesting, and I did consider starting a writer project at one point. And I might.

Writing files in a streaming fashion from a browser is based on hacks or loosely unrelated APIs, mostly depending on technologies that has nothing to do with files, or some experimental stuff. I'm not saying it shouldn't be done, but it's surely out of scope for this repository.

Writing a wrapper for the ideas expressed here could indeed be interesting:
https://github.com/jimmywarting/StreamSaver.js

Tewr commented

I'm closing this for now, feel free to reopen if there is anything to add to the discussion