Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/little-core-labs/nanochrome

Launch a Chrome Browser as a nanoprocess (nanoresource).
https://github.com/little-core-labs/nanochrome

chrome launch nanoprocess nanoresource

Last synced: about 2 months ago
JSON representation

Launch a Chrome Browser as a nanoprocess (nanoresource).

Awesome Lists containing this project

README

        

nanochrome
==========

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

## Installation

```sh
$ npm install nanochrome
```

## Status

> **Stable**

## Usage

```js
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][nanoprocess]) instance from `uri`
with optional `options` that are passed directly to
[`chrome.launch()`](
https://github.com/GoogleChrome/chrome-launcher#launchopts). `options` can also be:

```js
{
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](https://github.com/GoogleChrome/chrome-launcher/blob/HEAD/docs/chrome-flags-for-tools.md) 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

- [nanoprocess][nanoprocess]
- [nanoresource][nanoresource]
- [chrome-launcher][chrome-launcher]

## License

MIT

[nanoprocess]: https://github.com/little-core-labs/nanoprocess
[nanoresource]: https://github.com/mafintosh/nanoresource
[chrome-launcher]: https://github.com/GoogleChrome/chrome-launcher