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

just-launch-chrome

v1.1.0

Published

Just Launch Chrome ======================= [![node requirement](https://img.shields.io/badge/node-%3E%3D%208.6.0-brightgreen.svg?style=flat-square)](https://nodejs.org) [![sanic](https://img.shields.io/badge/speed-blazing%20%F0%9F%94%A5-brightgreen.svg?st

Downloads

58

Readme

Just Launch Chrome

node requirement sanic

Why cause sometimes you just want something to launch chrome with the remote debugging port set for you with or without defaults.

Getting Started

Installation

To use launch-chrome in your project, run:

yarn add just-launch-chrome
# or "npm i just-launch-chrome"

Usage

just-launch-chrome provides two basic operations finding Chrome/Chromium executables and launching Chrome/Chromium on supported platforms.

The supported platforms are

  • Linux
  • Mac OS (Darwin)
  • Windows
  • Windows Subsystems Linux

Finding Chrome

The simplest way to use just-launch-chrome as a means to find Chrome/Chromium executables is shown below

const { findChrome } = require('just-launch-chrome')

;(async () => {
 const executables = await findChrome()
 for (const exe of executables) {
   console.log(exe)
 }
})()

The return value of findChrome is an list, array, of discovered executables (path to the executable on the system).

launch-chrome also makes available each of the supported platforms finding functions available

  • findChromeLinux
  • findChromeDarwin
  • findChromeWindows
  • findChromeWSL

Launching Chrome

Launching chrome is done via the launch function as shown below

const { launch } = require('just-launch-chrome')

;(async () => {
  const { chromeProcess, closeBrowser, browserWSEndpoint } = await launch()

  // do stuff with chrome

  await closeBrowser()
})()

The return value of the function is a Promise that resolves to an object with the following properties

  • (ChildProcess) chromeProcess - The reference to the spawned chrome process
  • (function (): Promise) closeBrowser - A function that returns a Promise that resolves once the launched browser is closed
  • (string) browserWSEndpoint - The CDP websocket URL of the browser

Optional configuration options

  • (string) startingURL - The starting URL of the browser, defaults to about:blank
  • (string) executable - The Chrome/Chromium executable used for launching, defaults to the first executable found via findChrome
  • (string) userDataDir - Path to a directory to be used as the browser's user data directory, defaults to a temporary directory
  • (string) userDataDirPrefix - A prefix for the created temporary directory
  • (function(exes: Array): string) exeSelector - Function used to select the executable to be used rather than the first one found
  • (Array) args - A list of launch args
  • (boolean) handleSIGINT - should the launched browser be killed when the process receives the SIGINT signal, defaults to true
  • (boolean) handleSIGTERM should the launched browser be killed when the process receives the SIGTERM signal, defaults to true
  • (boolean) handleSIGHUP should the launched browser be killed when the process receives the SIGHUP signal, defaults to true
  • (boolean) dumpio - Should the browsers std out and err be displayed, defaults to false
  • (boolean) headless - Should the browser be launched in headless mode, defaults to false
  • (boolean) devtools - Should the devtools be opened in all tabs created, defaults to false
  • (boolean) muteAudio - Should audio be muted for all tabs opened, defaults to false
  • (boolean) hideScrollBars - Should scroll bars be hidden for all tabs opened, defaults to false
  • (number) port - The port number for the Chrome DevTools Protocol (CDP), defaults to the port chosen by chrome
  • (number) launchTimeout - Maximum length of time, in milliseconds, that should be waited before the launching of the browser is considered to not have happened, defaults to 30000
  • (Object) env - Environment variables that superceded the processes own environment to be used when launching the browser, defaults to the process own environment variables