Capture screenshot of a website and return it as a stream
$ npm install --save screenshot-stream
var fs = require('fs');
var screenshot = require('screenshot-stream');
var 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: Function
PhantomJS errors.
Type: Function
Warnings with eg. page errors.
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: String
Capture a specific DOM element.
Type: Object
Default: {}
Set custom headers.
Type: Array|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 jpeg
.
Type: Number
Default: 1
Scale webpage n
times.
Type: String|Array
Selector or array of selectors of elements which should be hidden via visibility: hidden
right before screen capturing
See the pageres CLI.
MIT © Kevin Mårtensson