Capture a screenshot of the desktop as a base64 encoded string.
Note: This module only works for OS X.
$ npm i -S desktop-capture
const capture = require("desktop-capture");
// capture the main monitor
capture().then(b64 => {
console.log(b64);
});
// capture a specific monitor (via screen ID)
capture({ id: 12345 }).then(b64 => {
console.log(b64);
});
// override the path to the bin directory
capture({ overridePath: __dirname }).then(b64 => {
console.log(b64);
});
With NPM:
$ npm run build
// -> ./desktop-capture
With Swift:
$ swift build
// -> ./build/release/desktop-capture
With NPM:
$ npm t
With Swift:
$ swift test
MIT © Vu Tran