import { getFileHandle } from "https://deno.land/x/ayonli_jsext@v0.9.72/fs.ts";
Obtains the file handle of the given path.
NOTE: This function is only available in the browser.
Examples
Example 1
Example 1
// with the default storage
import { getFileHandle } from "@ayonli/jsext/fs";
const file = await getFileHandle("/path/to/file.txt");
Example 2
Example 2
// with a user-selected directory as root (Chromium only)
import { getFileHandle } from "@ayonli/jsext/fs";
const root = await window.showDirectoryPicker();
const file = await getFileHandle("/path/to/file.txt", { root });
Example 3
Example 3
// create the file if not exist
import { getFileHandle } from "@ayonli/jsext/fs";
const file = await getFileHandle("/path/to/file.txt", { create: true });
Parameters
optional
options: GetFileOptions = [UNSUPPORTED]