chore: embrace web streams #20
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
port the following functions
fs.createReadStream(file): ReadableStreamshould add to#sitegen/fsfs.createWriteStream(file): ReadableStreamshould add to#sitegen/fscrypto.createHash(algo, WritableStream): Promise<string>zlib.createGzip()-> CompressionStreamzlib.createZstdCompress(): TransformStreamstream.promises.pipelineprobably just use the built-in APIchild_process.spawnshould add to#sitegen/subprocessreadline.createInterface(): TransformStreamcan derive from https://jsr.io/@std/streams/1.0.12/text_line_stream.tsthe node.js ones will probably have to be homegrown. either as wrappers around the node.js apis or whatever. it might be cute to see if other runtimes can be supported.
this can be done with more "overlay" modules like
#sitegen/fsembrace web streamsto chore: embrace web streamsi've started with new reading helpers at work (streams.BufferedReader), which is quite useful. the fact it works on browser fetch is probably a reason i should slowly move all work to it.
this is great because many of these will be added as libraries under
lib, which can be tailored to work in the browser and on the server. for example, lib's futurecrypto.HashStreamcan buffer in the web browser, but stream in native code.