Skip to content

Launch a Chrome Browser as a nanoprocess (nanoresource).

License

Notifications You must be signed in to change notification settings

little-core-labs/nanochrome

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

nanochrome

Launch a Chrome Browser as a nanoprocess that leverages chrome-launcher.

Installation

$ npm install nanochrome

Status

Stable

Usage

const nanochrome = require('nanochrome')

const chrome = nanochrome('https://example.com')

chrome.open((err) => {
  // chrome browser window opened
})

API

const chrome = nanochrome(uri[, options])

Creates a new Chrome (nanoprocess) instance from uri with optional options that are passed directly to chrome.launch(). options can also be:

{
  app: false, // set to `true` to launch URI in application mode (--app=)
  headless: false, // set `true` to run headless (--headless)
}

See Chrome Flags for Tools for a complete list of useful flags that can be passed in the opts.chromeFlags array.

chrome.open([callback])

Opens the Google Chrome browser calling callback(err) upon success or error.

chrome.close([callback])

Closes the Google Chrome browser calling callback(err) upon success or error.

See Also

License

MIT