import { readFile } from "https://deno.land/x/ayonli_jsext@v0.9.72/fs.ts";
Reads the content of the given file in bytes.
NOTE: This function can also be used in Cloudflare Workers.
Examples
Example 1
Example 1
// with the default storage
import { readFile } from "@ayonli/jsext/fs";
const bytes = await readFile("/path/to/file.txt");
Example 2
Example 2
// with a user-selected directory as root (Chromium only)
import { readFile } from "@ayonli/jsext/fs";
const root = await window.showDirectoryPicker();
const bytes = await readFile("/path/to/file.txt", { root });
Parameters
optional
options: ReadFileOptions = [UNSUPPORTED]