Simple and straightforward NPM package that calls screenshotlayer webpage capture / screenshot service.
Screenshotcap will accept an url and saves the captured screen onto a directory you have specified.
npm install screenshotcap [--save]
Screenshotcap is a API wrapper against the Screenshotcap service.
In order to start using the service, you will need to sign up for an account at ScreenShotLayer.com. After you have registered for an account, you will need to get the API access key from the Dashboard and also fill up the secret key.
const screenshotcap = require('screenshotcap');
const opts = {
url: 'https://twitter.com/AlvinLoh19', // The URL to capture
pathtowrite: '/some/path/with/filename.png' // The filepath with file name to write to
accesskey: 'YOUR API ACCESS KEY',
secretkey: 'YOUR API SECRET KEY',
viewport: '1400x900' // Optional parameter, will default to 1400x900
};
screenshotcap(opts).then(function(done){
console.log('Done writing file');
});
Currently, the library only supports writing to PNG files.