You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is a fs implementation that uses Web APIs instead of bespoke Node.js APIs. We don't need to port everything, just some of the most important pieces.
As a starting point, we should have createReadableStream and createWritableStream APIs that are analogous to Node's fs.createReadStream and fs.createWriteStream APIs for working with streams.
import{createReadableStream,createWritableStream}from'web-fs';// Read a fileletstream: ReadableStream=createReadableStream('file.txt');// Easily write a ReadableStream to diskletresponse=awaitfetch('http://github.com');awaitresponse.body.pipeTo(createWritableStream('github.html'));// Copy a fileawaitcreateReadableStream('file.txt').pipeTo(createWritableStream('file-copy.txt'));
We should also have openFile, readFile, and writeFile methods analogous to Node's (experimental) fs.openAsBlob, fs.readFile, and fs.writeFile functions, except they will be able to work with and returnFile objects.
This is a
fs
implementation that uses Web APIs instead of bespoke Node.js APIs. We don't need to port everything, just some of the most important pieces.As a starting point, we should have
createReadableStream
andcreateWritableStream
APIs that are analogous to Node'sfs.createReadStream
andfs.createWriteStream
APIs for working with streams.We should also have
openFile
,readFile
, andwriteFile
methods analogous to Node's (experimental)fs.openAsBlob
,fs.readFile
, andfs.writeFile
functions, except they will be able to work with andreturn
File
objects.The text was updated successfully, but these errors were encountered: