screenshot-native
Screenshots for NodeJS, blazingly fast and easy to use
Installing
yarn add sceenshot-native
or
npm i screenshot-native
Usage
import { screenshot, getRegion, screenSize, encode, toURL } from 'screenshot-native'
or
const { screenshot, getRegion, screenSize, encode, toURL } = require('screenshot-native')
Get a region of the screen
let image = getRegion(0,0,100,100) //Will return raw screenshot data
let encoded = encode(image,'png')
let base64 = toURL(encoded); // you can use this in browser
fs.writeFileSync('test.png',encoded) //or write to local file
Get full screenshot
let image = screenshot() //Will return raw screenshot data
let encoded = encode(image,'png')
let base64 = toURL(encoded); // you can use this in browser
fs.writeFileSync('test.png',encoded) //or write to local file