# nickel-chrome

> A server that use chrome headless to generate screenshots of HTML

Latest version **1.6.2** (published 2017-12-06) · BSD-2-Clause license · 0 weekly downloads

## Install

```sh
npm install nickel-chrome
pnpm add nickel-chrome
yarn add nickel-chrome
bun add nickel-chrome
```

Provides the command `nickel-chrome`.

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.6.2 |
| Published | 2017-12-06 |
| First published | 2017-10-06 |
| Weekly downloads | 0 |
| License | BSD-2-Clause |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 4 |
| Known vulnerabilities | 0 (+6 in 2 direct dependencies) |
| Install scripts | no |
| GitHub stars | 2 |
| Author | meriadec |
| Maintainers | meriadec |

## Links

- npm: https://www.npmjs.com/package/nickel-chrome
- Repository: git@github.com:meriadec/nickel-chrome
- npm.io page: https://npm.io/package/nickel-chrome

## Dependencies (4)

- [chalk](https://npm.io/package/chalk.md) ^2.1.0
- [debug](https://npm.io/package/debug.md) ^3.1.0
- [sharp](https://npm.io/package/sharp.md) ^0.18.4
- [puppeteer](https://npm.io/package/puppeteer.md) ^0.12.0

## Recent versions

- 1.6.2 (latest) — 2017-12-06
- 1.6.1 — 2017-11-29
- 1.6.0 — 2017-11-29
- 1.5.1 — 2017-11-17
- 1.5.0 — 2017-11-17
- 1.4.1 — 2017-11-13
- 1.4.0 — 2017-10-23
- 1.3.1 — 2017-10-10
- 1.3.0 — 2017-10-10
- 1.2.0 — 2017-10-09
- 1.1.0 — 2017-10-09
- 1.0.0 — 2017-10-06

## README

# nickel-chrome

## Install

```bash
yarn global add nickel-chrome
```

if you are patient, you can also install it with npm:

```
npm i -g nickel-chrome
```

## Usage

### Launch the nickel-chrome server

```bash
nickel-chrome
```

You can specify number of workers (*default: 5*):

```bash
nickel-chrome 3
```

You can change the default port (*default: 3010*):

```bash
NICKEL_CHROME_PORT=4242 nickel-chrome
```

You can also do nothing and nothing will happen.

### Create screenshots

The server will handle `POST` requests on `/`, with a payload looking like this:

```JSON
{
  "html": "<div>hello world</div>",
}
```

This is the only required property. Let's see what other options you have.

### Options

```js
{
  // the HTML to screenshot
  html: '',

  // specify page size
  viewportSize: {
    width: 650,
    height: 650,
    // the screenshot will be taken full page height
    fullPage: false,
  },

  // resize final image
  resize: {
    width: 300,
    // if not given, will resize conserving ratio
    height: 150,
  }

  // inject custom styles in page. the keys are querySelectors. the values
  // will be merged to CSSStyleDeclaration of the found node
  styles: {
    body: {
      marginTop: 40,
    },
    '.my-class': {
      backgroundColor: 'red',
    }
  },

  // capture the given element (can't be used with `fullPage`)
  selector: '.my-element',

  // wait for 'load' event on the page, until this max timeout
  loadTimeout: 300,
}
```

the response format will be a base64-encoded image.

## License

BSD-2-Clause

---
_Source: https://npm.io/package/nickel-chrome · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
