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

webshot-cli

v0.3.1

Published

> Easy website screenshots in CLI.

Downloads

16

Readme

Webshot CLI npm version

Easy website screenshots in CLI.

Description

This software is a wrapper around the Webshot library, providing a simple command to take local or remote webpage screenshots.

Usage: webshot [--custom-header=<header>]... [options] [<url>] [<dest>]

Arguments:
  <url>   A webpage URL (can be a local file) [default: -].
  <dest>  Where to save the image [default: -].

Options:
  -h, --help                  Show this help.
  --version                   Show version.
  --window-size=<size>        Browser window size [default: 1024/768].
  --shot-size=<size>          The area to capture [default: window/window].
  --shot-offset=<offset>      Left, right, top and bottom offset [default: 0/0/0/0].
  --phantom-path=<path>       The location of PhantomJS [default: phantomjs].
  --custom-header=<header>    Additional header (can be set multiple times).
  --default-white-background  White background if no background is set.
  --custom-css=<css>          Custom CSS rules.
  --quality=<quality>         JPEG compression quality [default: 75].
  --stream-type=<type>        Streaming file type [default: png].
  --render-delay=<delay>      Number of milliseconds to wait [default: 0].
  --timeout=<timeout>         Kill PhantomJS after this number of milliseconds [default: 0].
  --shot-callback             Wait for `window.callPhantom('takeShot');`.
  --http-error                Cause an error if HTTP status is not 200.

See <https://github.com/brenden/node-webshot> for options details.

All options beginning with `--p:` like `--p:cookies-path` are passed
to PhantomJS. See <http://phantomjs.org/api/command-line.html>.

The main difference with the Webshot library is you don't have to give an absolute file:// URL to capture a local file with working assets. The software will resolve it for you.

Examples

Standard I/O screenshot:

webshot < example.html > example.png
webshot --quality=100 --stream-type=jpeg < example.html > example.jpeg

Shot an URL:

webshot example.html example.png
webshot 'https://www.npmjs.org/' npmjs.png

For example.html, the difference with the I/O version is the relative assets will be loaded properly.

Bugs

  • When proxying an option to PhantomJS with --p: prefix, if it's an unknown option for PhantomJS, PhantomJS will crash but no error is returned. I believe it's more a bug with Webshot (or maybe PhantomJS does nothing but don't return an error code).