Socket
Socket
Sign inDemoInstall

webshot-cli

Package Overview
Dependencies
2
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

webshot-cli

> Easy website screenshots in CLI.


Version published
Maintainers
1
Weekly downloads
4
increased by300%

Weekly downloads

Readme

Source

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).

FAQs

Last updated on 03 Jan 2016

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc