Skip to main content

property Deno.FsFile.prototype.readable

A ReadableStream instance representing to the byte contents of the file. This makes it easy to interoperate with other web streams based APIs.

using file = await Deno.open("my_file.txt", { read: true });
const decoder = new TextDecoder();
for await (const chunk of file.readable) {
  console.log(decoder.decode(chunk));
}

Note that the readable stream takes ownership of the file: reading the stream to completion (or cancelling it) closes the file automatically, so you should not close the file yourself while the stream is still being consumed.

Type #

ReadableStream<Uint8Array<ArrayBuffer>>

Did you find what you needed?

Privacy policy