Capture a screenshot of the desktop as a base64 encoded string.
Note: This module only works for OS X.
$ npm i -S desktop-captureconst 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-captureWith Swift:
$ swift build
// -> ./build/release/desktop-captureWith NPM:
$ npm tWith Swift:
$ swift testMIT © Vu Tran