
Security News
TC39 Advances 11 Proposals for Math Precision, Binary APIs, and More
TC39 advances 11 JavaScript proposals, with two moving to Stage 4, bringing better math, binary APIs, and more features one step closer to the ECMAScript spec.
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 563,781 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.
Security News
TC39 advances 11 JavaScript proposals, with two moving to Stage 4, bringing better math, binary APIs, and more features one step closer to the ECMAScript spec.
Research
/Security News
A flawed sandbox in @nestjs/devtools-integration lets attackers run code on your machine via CSRF, leading to full Remote Code Execution (RCE).
Product
Customize license detection with Socket’s new license overlays: gain control, reduce noise, and handle edge cases with precision.