Skip to main content

open-default

This is a simple wrapper script designed to open a file in the default application for each operating system. It is particularly useful if you want to add a script to your package.json for opening files.

Unlike other solutions, such as open-cli, this script is concise, consisting of only a few lines of code, and has no dependencies.

Installation

npm install open-default --save-dev

Usage

open-default <path>

Commands Used

The following commands are utilized to open a file based on the operating system:

Operating SystemCommand
Windowsstart
macOSopen
Linuxxdg-open
FreeBSDxdg-open
OpenBSDxdg-open

View open-default on NPM