import { pickFiles } from "https://deno.land/x/ayonli_jsext@v0.9.72/dialog/file.ts";
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
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
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: FileDialogOptions = [UNSUPPORTED]