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

x/ayonli_jsext/esm/fs.js>getFileHandle

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

Obtains the file handle of the given path.

NOTE: This function is only available in the browser.

Examples

Example 1

// with the default storage
import { getFileHandle } from "@ayonli/jsext/fs";

const file = await getFileHandle("/path/to/file.txt");

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

// create the file if not exist
import { getFileHandle } from "@ayonli/jsext/fs";

const file = await getFileHandle("/path/to/file.txt", { create: true });

Parameters

path
optional
options = [UNSUPPORTED]