npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

bopen

v2.6.0

Published

A better native open utility. Open URLs, paths and locators in the default or specified browser with options including opening in incognito mode. Cross-platform.

Downloads

425

Readme

bopen

npm version

A better native open utility for macOS and Windows, with emphasis on browsers and sugar for common configuration. Open URLs, file paths and other locators as supported by your system.

Provide the location and optionally the target browser or application, and whether to open in incognito/private mode, alongside initial arguments and app arguments. Rather than exec, bopen spawns the target process for improved safety.

See bopen-cli (NPM) for the CLI.

Install

$ npm install --save bopen

Usage

const bopen = require('bopen')

// Open URL in default browser
bopen('http://example.com')

// Open URL in Google Chrome
bopen('http://example.com', {browser: 'chrome'})

// Open URL in Firefox
bopen('http://example.com', {browser: 'firefox'})

// Open URL in Internet Explorer
bopen('http://example.com', {browser: 'ie'})

// Open URL in Edge
bopen('http://example.com', {browser: 'edge'})

// Open URL in Safari
bopen('http://example.com', {browser: 'safari'})

// Open URL in Google Chrome in incognito mode
bopen('http://example.com', {browser: 'chrome', incognito: true})

// Open URL in Google Chrome in incognito mode in the background
bopen('http://example.com', {browser: 'chrome', incognito: true, background: true})

// Open URL in Internet Explorer with InPrivate mode
bopen('http://example.com', {browser: 'ie', incognito: true})

// Open file path
bopen('/Users/ajrg')

// Open an image in the default viewer
bopen('image.png')

// Open an image in the specified application
bopen('image.png', {app: 'preview'})

Supported Browsers

| Browser | bopen name | Incognito/private mode launch support | |-------------------|-----------------|---------------------------------------| | Google Chrome | chrome | Yes (Incognito) | | Mozilla Firefox | firefox | Yes (Private) | | Internet Explorer | ie | Yes (InPrivate) | | Safari | safari | Yes (Private) | | Microsoft Edge | edge | No |

Supported Platforms

  • macOS. Tested in Chrome, Firefox and Safari. Optimised for Chrome and Firefox.
  • Windows. Tested in Chrome, Edge and IE. Optimised for Chrome and IE.

Incognito launch support for Chrome, Firefox and IE. In Firefox, opening incognito with a URL is supported if an incognito window is not already open. Edge incognito support is awaiting command line switch support from Microsoft.

API

bopen(location, [options])

Opens the location with optional options. Returns a promise with the command and arguments.

location

string. Required. The path to open, such as a URL or file.

options

object. Optional.

browser

string. Optional. Default: default browser. Open the URL in the specified browser. The browser name is platform agnostic — you do not need to reference the platform specific app name. Use the Browsers table for reference. For example, with Google Chrome, the bopen browser is "chrome". The browser option overrides app.

incognito

boolean. Optional. Default: false. Open the URL in the browser's incognito mode.

background

boolean. Optional. Default: false. Open the path in the background.

app

string. Optional. Default: default opener. You can specify the app for non-URL locations when you want to use another opener application. The app option is overridden by browser.

args

array. Optional. Default: []. You can pass in initial arguments to the opener command.

appArgs

array. Optional. Default: []. Specify additional arguments for the target application.

License

Apache 2.0. © Alex Greenland, ajrg.co