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

x/ayonli_jsext/esm/dialog.js>pickFiles

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

Opens the file picker dialog and pick multiple files, this function returns the paths or FileSystemFileHandle objects in the browser of the files selected.

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

Examples

Example 1

// default usage
import { pickFiles } from "@ayonli/jsext/dialog";

// Node.js, Deno, Bun
const filenames = await pickFiles() as string[];

// Browser (Chrome)
const handles = await pickFiles() as FileSystemFileHandle[];

Example 2

// filter by MIME type
import { pickFiles } from "@ayonli/jsext/dialog";

// Node.js, Deno, Bun
const filenames = await pickFiles({ type: "image/*" }) as string[];

// Browser (Chrome)
const handles = await pickFiles({ type: "image/*" }) as FileSystemFileHandle[];

Parameters

optional
options = [UNSUPPORTED]