GoogleChromeLabs / browser-fs-access

File System Access API with legacy fallback in the browser
https://googlechromelabs.github.io/browser-fs-access/demo/
Apache License 2.0
1.38k stars 84 forks source link

Add Streams API Support #66

Closed seanaye closed 2 years ago

seanaye commented 3 years ago

Using the streams API is it possible to pipe data into a file handler e.g.

const fileHandle = await showSaveFilePicker();
const writableStream = await fileHandle.createWritable();
compressedStream.pipeTo(writableStream);

Could we add support for passing a stream to this library to more efficiently handle saving large files. Obviously passing a stream in legacy mode would either need to reject or build a blob from the stream and save that.

Would this been considered within the scope of this library? I'm open to working on a PR

tomayac commented 3 years ago

Hi @seanaye! This would absolutely be in-scope. As you say, it'd need to deal with the legacy approach somehow. Thanks for your work in advance!