
Research
Security News
The Growing Risk of Malicious Browser Extensions
Socket researchers uncover how browser extensions in trusted stores are used to hijack sessions, redirect traffic, and manipulate user behavior.
Open a URL via the operating system (http: in default browser, mailto: in mail client etc.
The openurl npm package allows you to open URLs, files, and email addresses in the default application for your operating system. It is a simple utility that can be used to trigger the default browser, email client, or file viewer.
Open a URL in the default web browser
This feature allows you to open a specified URL in the default web browser of the user's operating system.
const openurl = require('openurl');
openurl.open('http://www.google.com');
Open a file in the default application
This feature allows you to open a specified file in the default application associated with the file type on the user's operating system.
const openurl = require('openurl');
openurl.open('/path/to/your/file.txt');
Open an email client with a pre-filled email
This feature allows you to open the default email client with a new email draft pre-filled with the specified recipients, subject, and body.
const openurl = require('openurl');
openurl.mailto(['example@example.com'], { subject: 'Hello', body: 'Hello, world!' });
The 'open' package provides similar functionality to 'openurl' by allowing you to open files, URLs, and email addresses in the default application. It offers more options and better cross-platform support compared to 'openurl'.
The 'opn' package (now deprecated in favor of 'open') also allows you to open files and URLs in the default application. It is known for its simplicity and ease of use, similar to 'openurl'.
The 'open-cli' package is a command-line interface for the 'open' package, allowing you to open files and URLs from the command line. It is useful for scripting and automation purposes.
openurl is a Node.js module for opening a URL via the operating system. This will usually trigger actions such as:
Example interaction on the Node.js REPL:
> require("openurl").open("http://rauschma.de")
> require("openurl").open("mailto:john@example.com")
You can generate emails as follows:
require("openurl").mailto(["john@example.com", "jane@example.com"],
{ subject: "Hello!", body: "This is\nan automatically sent email!\n" });
Install via npm:
npm install openurl
I’m not yet terribly familiar with implementing npm packages, so any feedback is welcome (especially experience reports on Windows and Linux, which I can’t test on).
Related reading:
FAQs
Open a URL via the operating system (http: in default browser, mailto: in mail client etc.
The npm package openurl receives a total of 556,896 weekly downloads. As such, openurl popularity was classified as popular.
We found that openurl demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
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.
Research
Security News
Socket researchers uncover how browser extensions in trusted stores are used to hijack sessions, redirect traffic, and manipulate user behavior.
Research
Security News
An in-depth analysis of credential stealers, crypto drainers, cryptojackers, and clipboard hijackers abusing open source package registries to compromise Web3 development environments.
Security News
pnpm 10.12.1 introduces a global virtual store for faster installs and new options for managing dependencies with version catalogs.