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

x/ayonli_jsext/dialog/file.ts>pickDirectory

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

Opens the file picker dialog and pick a directory, this function returns the directory's path or FileSystemDirectoryHandle in the browser.

NOTE: Browser support is limited to the chromium-based browsers.

Examples

Example 1

import { pickDirectory } from "@ayonli/jsext/dialog";

// Node.js, Deno, Bun
const dirname = await pickDirectory() as string | null;

// Browser (Chrome)
const handle = await pickDirectory() as FileSystemDirectoryHandle | null;

Parameters

optional
options: Pick<FileDialogOptions, "title"> = [UNSUPPORTED]

Returns

Promise<string | FileSystemDirectoryHandle | null>