0.0.2 • Published 10 months ago

open-finder-dialog v0.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
10 months ago

open-finder-dialog NPM version NPM monthly downloads NPM total downloads

Open a finder dialog window (finder prompt) programmatically. Only works on MacOS.

Please consider following this project's author, Jon Schlinkert, and consider starring the project to show your :heart: and support.

Install

Install with npm:

$ npm install --save open-finder-dialog

Usage

import { openFinderDialog } from 'open-finder-dialog';
// or
import openFinderDialog from 'open-finder-dialog';

API

Signature:

export const openFinderDialog = async (filepath?: string, terminal?: string): Promise<string>;

Example usage:

// Open the dialog in the current working directory
const selectedPaths = await openFinderDialog();
console.log('Selected paths:', selectedPaths);

Opens a Finder dialog to select files and returns the paths of selected files. You'll need to split these files into an array yourself, in case additional handling is required.

Params

filepath (optional)

The initial directory where the dialog should open. Defaults to the current working directory.

const selectedPaths = await openFinderDialog('/some/file/path.txt');

terminal (optional)

Optionally specify a terminal app, so we can reliably return focus after the dialog is closed. By default, detect-terminal is used when no argument is passed.

const selectedPaths = await openFinderDialog(null, 'iterm');

About

Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.

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 test

(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 && verb

Author

Jon Schlinkert

License

Copyright © 2024, Jon Schlinkert. Released under the MIT License.


This file was generated by verb-generate-readme, v0.8.0, on September 30, 2024.