Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/ayonli_jsext/fs.ts>createReadableStream

A JavaScript extension package for building strong and modern applications.
Latest
function createReadableStream
import { createReadableStream } from "https://deno.land/x/ayonli_jsext@v0.9.72/fs.ts";

Creates a readable stream for the target file.

NOTE: In Node.js, this function requires Node.js v18.0 or above.

Examples

Example 1

// with the default storage
import { createReadableStream } from "@ayonli/jsext/fs";
import { readAsText } from "@ayonli/jsext/reader";

const input = createReadableStream("/path/to/file.txt");

const text = await readAsText(input);
console.log(text);

Example 2

// with a user-selected directory as root (Chromium only)
import { createReadableStream } from "@ayonli/jsext/fs";
import { readAsText } from "@ayonli/jsext/reader";

const root = await window.showDirectoryPicker();
const input = createReadableStream("/path/to/file.txt", { root });

const text = await readAsText(input);
console.log(text);

Parameters

target: string | FileSystemFileHandle
optional
options: FileSystemOptions = [UNSUPPORTED]