open is a Node.js package that opens URLs, files, and executables in their default applications across macOS, Windows, and Linux.
The package solves the problem of cross-platform application launching in command-line tools and scripts. It wraps the native open commands available on each operating system—`open` on macOS, `start` on Windows, and `xdg-open` on Linux—into a unified JavaScript API. The approach uses `spawn` instead of `exec` for safer process execution and includes the latest `xdg-open` script for Linux. It supports passing arguments to applications and can handle WSL paths to Windows applications.
The tool is designed for Node.js command-line tools and scripts, not for browser environments; Electron users should use `shell.openPath()` instead. It suits projects that need to programmatically launch applications without hardcoding platform-specific commands. The package is native ESM only and does not provide CommonJS exports, so projects using CommonJS must either convert to ESM or use dynamic imports. The tool does not make security guarantees, so users must sanitize untrusted input before passing it to the package.
The project maintains active development with regular updates. It provides platform-specific options including a `wait` parameter to block until the opened application exits, a `background` option on macOS to prevent bringing the app to the foreground, and a `newInstance` option on macOS to launch a new instance even if the app is already running. The package supports specifying which application to use for opening a target, with fallback to alternative apps if the primary choice fails, and includes an `apps` utility for auto-detecting correct application binaries across platforms.