Capture screenshot of a website and return it as a stream
$ npm install --save screenshot-stream
const fs = require('fs');
const screenshot = require('screenshot-stream');
const stream = screenshot('http://google.com', '1024x768', {crop: true});
stream.pipe(fs.createWriteStream('google.com-1024x768.png'));
Type: string
Add page to capture.
Type: string
Set viewport size.
Type: Object
Define options to be used.
Type: Boolean
Default: false
Crop to the set height.
Type: number
(seconds)
Default: 0
Delay capturing the screenshot. Useful when the site does things after load that you want to capture.
Type: number
(seconds)
Default: 60
Number of seconds after which PhantomJS aborts the request.
Type: string
Capture a specific DOM element.
Type: string
Apply custom CSS to the webpage. Specify some CSS or the path to a CSS file.
Type: string
Apply custom JavaScript to the webpage. Specify some JavaScript or the path to a file.
Type: Array
Hide an array of DOM elements.
Type: Object
Default: {}
Set custom headers.
Type: Array
or Object
A string with the same format as a browser cookie or an object of what phantomjs.addCookie
accepts.
Type: string
Username for authenticating with HTTP auth.
Type: string
Password for authenticating with HTTP auth.
Type: string
Default: png
Set format to render the image as. Supported formats are png
and jpg
.
Type: number
Default: 1
Scale webpage n
times.
Type: string
Set a custom user agent.
Type: Boolean
Default: false
Set background color to transparent
instead of white
if no background is set.
Type: Function
PhantomJS errors.
Type: Function
Warnings with for example page errors.
See the pageres CLI.
MIT © Kevin Mårtensson