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