Create screenshots using node-webkit
npm install node-webkit-screenshot
var fs = require('fs');
var screenshot = require('node-webkit-screenshot');
screenshot({
url : 'http://google.de',
width : 1024,
height : 768
})
.then(function(buffer){
fs.writeFile('./out.png', buffer, function(){
// This will close the screenshot service
screenshot.close();
});
});
Type: number
Default: 3000
Specify custom port number for the webkit browser
Type: number
(seconds)
Default: 0
Delay capturing the screenshot.
Useful when the site does things after load that you want to capture.
Type: string
png|jpeg
Default: png
Specify the image type fot he screenshot
Type: int
Default: 0
Specify the with of the browser window
Type: int
Default: 0
Specify the height of the browser window
Type: Object
Default: undefined
This will only work if generating png's. A crop object may look like this:
{
top : 10,
left : 10,
width : 100,
height : 100
}
This will close the node-webkit
process. You have to call this function before node is able to exit.
If you would like to use this on travis or with a framebuffer like xvfb than you need to set the environment variable
NODESCREENSHOT_SHOW
to 1
. (export NODESCREENSHOT_SHOW
).
See this .travis.yml
for more information
- Fix installation of sub modules for nw-screenshot
- Upgrade various modules
- Fix black backgrounds in screenshots.
- Add
close()
method.
- remove
toolbar
for node-webkit - Add
crop
option.
- Rewrite using socket.io to communicate between a single nw-snapshot instance.
- Promise based API
- 0.1.0 Inital release