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

chrome-runner

v1.3.5

Published

headless chrome runner launcher

Downloads

38

Readme

Npm Package Build Status Build Status Dependency Status Npm Downloads

chrome-runner

Run chrome with ease from node.

  • Support OSX Linux Windows system
  • Handle chrome unexpected exit and restart it
  • Opens up the browser's remote-debugging-port on an available port
  • Automatic locates a Chrome binary to launch
  • Uses a fresh Chrome profile for each launch, and cleans itself up on kill()
  • Support typescript

Use

const {Runner,launch,launchWithoutNoise,launchWithHeadless} = require('chrome-runner');
// launch a chrome, launch return a Runner instance
const runner = await launch();
// read chrome remote debugging port
runner.port;
// kill this chrome
await runner.kill();

Options

launch() method can pass options by launch({name:value}). Include:

  • port: {number} launch chrome listen on debug port, default will random a free port to use
  • chromePath: {string} chrome executable full path, default will automatic find a path according to your system. If no executable chrome find, will use env CHROME_PATH as executable full path. If all of the above way can't get a path a Error('no chrome installations found') will throw
  • chromeFlags: {Array} flags pass to chrome when start chrome, all flags can be find here
  • startupPage: {string} open page when chrome start, default is about:blank
  • shouldRestartChrome: {boole} logger to handle log from chrome-runner, interface like console, default use console
  • monitorInterval: {number} in ms, monitor chrome is alive interval, default is 500ms
  • chromeDataDir: {string} chrome data dir, default will create one in system tmp
  • disableLogging: {boolean} Controls if Chome stdout and stderr is logged to file, default is true.

Runner API

  • runner.port: get chrome remove debug port
  • runner.kill(): kill chrome and release all resource and remove temp files

Events

Runner extends EventEmitter, it will emit some events in it's lifecycle, Include:

  • chromeAlive(port): when monitor detect chrome is alive
  • chromeDead(code, signal): after monitor detect chrome is not alive
  • chromeRestarted(): after chrome unexpected exited then runner restart it
  • chromeDataDirPrepared(chromeDataDir): after runner create data dir for chrome
  • chromeDataDirRemoved(chromeDataDir): after remove successful create data dir for chrome

launchWithoutNoise

launchWithoutNoise same with launch but disables many chrome services that add noise to automated scenarios.

launchWithHeadless

launchWithHeadless same with launch but run chrome in headless mode and without noise.

more use case see unit test, API detail see d.ts

Chrome log files

After chrome launched, chrome's log and pid file will be pipe to file in chromeDataDir, Include:

  • chrome-out.log chrome info log
  • chrome-err.log chrome error log
  • chrome.pid chrome pid file

Install chrome on linux server

chrome-runner required chrome installed on your system, it easy to install on OSX and Windows, Linux server see How to install Chrome browser properly via command line?

Use Case

chrome-runner has been used in many project, e.g: