import { openFiles } from "https://deno.land/x/ayonli_jsext@v0.9.72/esm/dialog/file.js";
Opens the file picker dialog and selects multiple files to open.
Examples
Example 1
Example 1
// default usage
import { openFiles } from "@ayonli/jsext/dialog";
const files = await openFiles();
if (files.length > 0) {
console.log(`You selected: ${files.map(file => file.name).join(", ")}`);
}
Example 2
Example 2
// filter by MIME type
import { openFiles } from "@ayonli/jsext/dialog";
const files = await openFiles({ type: "image/*" });
if (files.length > 0) {
console.log(`You selected: ${files.map(file => file.name).join(", ")}`);
console.assert(files.every(file => file.type.startsWith("image/")));
}