Cross-platform library for opening a file manager dialog window programmatically on MacOS, Windows, or Linux.
Please consider following this project's author, Jon Schlinkert, and consider starring the project to show your ❤️ and support.
Install with npm:
$ npm install --save open-file-manager-dialogimport { openFileManagerDialog, parsePaths } from 'open-file-manager-dialog';
// or
import openFileManagerDialog from 'open-file-manager-dialog';Signature:
export const openFileManagerDialog = async (
dirname?: string,
options?: { multiple?: boolean; filter?: string; }
): Promise<string[]>;This library is powered by open-finder-dialog, open-linux-file-dialog, and open-windows-file-dialog. See their documentation for more details and to learn about available options.
// Open the dialog in the current working directory
const selectedPaths = await openFileManagerDialog();
console.log('Selected paths:', selectedPaths);Opens the native file manager dialog for the current OS (Windows, macOS, or Linux) to select files or directories. Returns the paths of selected files as an array of strings.
dirname (optional)
The initial directory or file path where the dialog should open. Defaults to the current working directory.
const selectedPaths = await openFileManagerDialog('/some/folder');options (optional)
multiple(boolean): Allow selection of multiple files (default:false).filter(string): Filter file types, for example"*.jpg".
// Allow selecting multiple PDF files from a directory
const { files, canceled } = await openFileManagerDialog('/some/folder', {
multiple: true,
filter: ['pdf']
});You might also be interested in:
- open-file-manager: Cross-platform utility to open a file or directory in the system's default file manager (Finder… more | homepage
- open-finder-dialog: Open a finder dialog window (finder prompt) programmatically. Only works on MacOS. | homepage
- open-linux-file-dialog: Open a file dialog window programmatically to allow the user to select one or more… more | homepage
- open-windows-file-dialog: Programmatically open a file dialog window (explorer) for picking files. Only works on Windows. Also… more | homepage
Contributing
Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.
Running Tests
Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command:
$ npm install && npm testBuilding docs
(This project's readme.md is generated by verb, please don't edit the readme directly. Any changes to the readme must be made in the .verb.md readme template.)
To generate the readme, run the following command:
$ npm install -g verbose/verb#dev verb-generate-readme && verbJon Schlinkert
Copyright © 2025, Jon Schlinkert. Released under the MIT License.
This file was generated by verb-generate-readme, v0.8.0, on May 25, 2025.