talira

Open URLs, files and apps from Node.js, on any platform

open sourceMITfree

open is a Node.js package for command-line tools and scripts that opens URLs, files and executables with the default app, or a chosen app with arguments, on macOS, Windows, Linux and WSL. It uses spawn rather than exec, bundles the latest xdg-open script for Linux, can wait for the opened app to quit, and handles WSL paths to Windows apps.

Problems it solves

  • open a URL in the default browser from a Node CLI
  • open a file with its default app from a Node script
  • launch a specific app from Node.js cross-platform

Features

  • opens URLs, files and executables with the default app
  • choose an app and pass arguments
  • wait for the opened app to quit
  • bundled xdg-open for Linux and WSL path support

Limitations

  • ESM only, with no CommonJS export.1
  • Makes no security guarantees: untrusted input must be sanitised first.1