4.0.0 • Published 3 years ago

screenie-server v4.0.0

Weekly downloads
101
License
MIT
Repository
github
Last release
3 years ago

screenie-server

HTTP screenshot service based on Puppeteer.

Creates a HTTP server using Koa, by default on port 3000. It renders pages and creates screenshots of them on request.

Installation / Usage

You can install from npm and run the server manually:

npm install screenie-server
./node_modules/.bin/screenie-server

Alternatively, we provide a Docker image (built from the Dockerfile) at eliksir/screenie-server. This container is not running in sandbox mode because the Docker image doesn't support user namespaces.

Configuration

Then request a screenshot of an URL using the url query parameter: http://localhost:3000/?url=http://google.com/&format=jpeg

The size of the screenshot can be customized through the width and height query parameters, but will always be constrained within 2048x2048. The default size used when the parameters are missing can be customized by environment variables:

  • SCREENIE_WIDTH: Default width, as integer, in pixels (default 1024).
  • SCREENIE_HEIGHT: Default height, as integer, in pixels (default 768).

The format query parameter can be used to request a specific format of the screenshot. The supported formats are PNG, JPEG and even PDF. You can also set the default format through an environment variable:

  • SCREENIE_DEFAULT_FORMAT: Default format (default jpeg).

The Puppeteer pool can also be customized with environment variables:

  • SCREENIE_POOL_MIN: Minimum number of Puppeteer instances (default 2).
  • SCREENIE_POOL_MAX: Maximum number of Puppeteer instances (default 10).

To control the level of logging that will be performed, customize the SCREENIE_LOG_LEVEL environment variable. Supported values are error, warn, info, verbose, debug, and silly, though only info and verbose are currently in use.

  • SCREENIE_LOG_LEVEL: Logging level (default info).

To open up file scheme in URL parameter:

  • SCREENIE_ALLOW_FILE_SCHEME: true (default false).

Delay from the load event until the screenshot is taken. This can solve issues with rendering (i.e. rendering webfonts) not being complete before the screenshot.

  • SCREENIE_SCREENSHOT_DELAY: Time in milliseconds (default 50).

And lastly, of course the HTTP port can be customized:

  • SCREENIE_PORT: HTTP port (default 3000).

Contributing

We are open to contributions or suggestions. File issues or suggestions on the GitHub issues page, and please do submit a pull request if you have the time to implement an improvement or bugfix.

License

Published under the MIT license.

4.0.0-beta

3 years ago

4.0.0

3 years ago

3.0.0

4 years ago

3.0.0-beta.2

5 years ago

3.0.0-beta.1

5 years ago

3.0.0-beta

5 years ago

2.0.0

6 years ago

2.0.0-alpha.3

6 years ago

2.0.0-alpha.2

6 years ago

2.0.0-alpha.1

6 years ago

1.2.0

7 years ago

1.1.0

7 years ago

1.0.0

7 years ago