copy
import { copy } from "jsr:@ende/io";function
async function copy(src: Reader, dst: Writer, options?: { bufSize?: number }): Promise<number>Copies from src to dst until either EOF (null) is read from src or
an error occurs. It resolves to the number of bytes copied or rejects with
the first error encountered while copying.
src: ReaderThe source to copy from
dst: WriterThe destination to copy to
options?: { bufSize?: number }Can be used to tune size of the buffer. Default size is 32kB
Returns
Number of bytes copied
Example: Usage
import { copy } from "@ende/io/copy";
const source = await Ende.open("my_file.txt");
const bytesCopied1 = await copy(source, Ende.stdout);
const destination = await Ende.create("my_file_2.txt");
const bytesCopied2 = await copy(source, destination);