Skip to content

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

Notifications You must be signed in to change notification settings

vutran/desktop-capture

Repository files navigation

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)

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published