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

screenie-server

v4.0.0

Published

A screenshot HTTP service using Puppeteer

Downloads

25

Readme

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.