vutran / desktop-capture

Capture a screenshot of the desktop as a base64 encoded string. (OS X Only)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

desktop-capture

Capture a screenshot of the desktop as a base64 encoded string.

Note: This module only works for OS X.

Install

$ npm i -S desktop-capture

Usage

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);
});

Build

With NPM:

$ npm run build
// -> ./desktop-capture

With Swift:

$ swift build
// -> ./build/release/desktop-capture

Test

With NPM:

$ npm t

With Swift:

$ swift test

License

MIT © Vu Tran

About

Capture a screenshot of the desktop as a base64 encoded string. (OS X Only)


Languages

Language:Swift 93.3%Language:JavaScript 6.7%