Socket
Socket
Sign inDemoInstall

open

Package Overview
Dependencies
0
Maintainers
2
Versions
48
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

open

open a file or url in the user's preferred application


Version published
Maintainers
2
Weekly downloads
33,993,813
decreased by-10.16%

Weekly downloads

Package description

What is open?

The 'open' npm package is a simple utility to open a file, URL, or executable in the default program associated with that file type on the user's operating system. It can be used to open resources in the default browser, editor, or any other program.

What are open's main functionalities?

Open URLs in the default web browser

This feature allows you to open a URL in the user's default web browser.

const open = require('open');
open('https://www.example.com');

Open files in the default application

This feature allows you to open a file in the default application associated with its file type, such as a PDF in a PDF viewer.

const open = require('open');
open('path/to/file.pdf');

Open files with a specific application

This feature allows you to open a file with a specific application, bypassing the default application.

const open = require('open');
open('path/to/file.txt', {app: {name: 'notepad'}});

Open files with application and arguments

This feature allows you to open a file with a specific application and pass command-line arguments to the application.

const open = require('open');
open('path/to/file', {app: {name: 'app-name', arguments: ['--arg1', '--arg2']}});

Other packages similar to open

Readme

Source

open

Open a file or url in the user's preferred application.

Usage

var open = require("open");
open("http://www.google.com");

open taks an optional argument specifying the program to be used to open the file or URL.

open("http://www.google.com", "firefox");

Installation

npm install open

How it works

  • on win32 uses start
  • on darwin uses open
  • otherwise uses the xdg-open script from freedesktop.org

Warning

The same care should be taken when calling open as if you were calling child_process.exec directly. If it is an executable it will run in a new shell.

Keywords

FAQs

Last updated on 25 Jul 2013

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc