1.0.3 • Published 8 years ago
snapkit v1.0.3
snapkit
Capture screenshots of websites on command line or REST API.
$ snapkit https://google.com --emulate="iPad" | open -a Preview.app -f
Or, from inside your own Node.js program.
const snapkit = require('snapkit')
async () => {
let image = await snapkit('https://google.com')
}
/* snapkit has a child process that starts on import, close it */
async close => snapkit.close()
snapkit(url||content, options)
Accepts either HTML page content as as string or a URL to a remote site.
options
<Object>emulate
<string> Device to emulate, list of available devices atsnapkit.devices
transparency
<boolean> Hides default white background and allows capturing screenshots with transparency. Defaults tofalse
.userAgent
<string>type
<string> Specify screenshot type, can be eitherjpeg
orpng
. Defaults to 'png'.quality
<number> The quality of the image, between 0-100. Not applicable topng
images.fullPage
<boolean> When true, takes a screenshot of the full scrollable page. Defaults tofalse
.viewport
<Object>width
<number> page width in pixels.height
<number> page height in pixels.deviceScaleFactor
<number> Specify device scale factor (can be thought of as dpr). Defaults to1
.isMobile
<boolean> Whether themeta viewport
tag is taken into account. Defaults tofalse
.hasTouch
<boolean> Specifies if viewport supports touch events. Defaults tofalse
isLandscape
<boolean> Specifies if viewport is in landscape mode. Defaults tofalse
.
clip
<Object> An object which specifies clipping region of the page. Should have the following fields:
snapkit.devices
Array of available device emulations.
snapkit.close()
Close the browser instance and child process.