screenshot-native
Version:
Screenshots for NodeJS, blazingly fast and easy to use
32 lines (28 loc) • 882 B
Markdown
Screenshots for NodeJS, blazingly fast and easy to use
Installing
```
yarn add sceenshot-native
or
npm i screenshot-native
```
Usage
```js
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
```js
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
```js
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
```