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

x/ayonli_jsext/dialog/file.ts>openFiles

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

Opens the file picker dialog and selects multiple files to open.

Examples

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

// 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/")));
}

Parameters

optional
options: FileDialogOptions = [UNSUPPORTED]

Returns

Promise<File[]>