How to use the screenshot-desktop.windowsSnapshot function in screenshot-desktop

To help you get started, we’ve selected a few screenshot-desktop examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github web-pal / chronos-timetracker / app / renderer / sagas / screenshots.js View on Github external
process.env.NODE_ENV === 'development'
      ? (
        path.join(
          appPath.split('node_modules')[0],
          'node_modules/screenshot-desktop/lib/win32',
        )
      ) : (
        path.join(
          appPath.split('app.asar')[0],
          'screenshot-desktop/',
        )
      )
  );


  screenshot.windowsSnapshot = function windowsSnapshot(options = {}) {
    return new Promise((resolve, reject) => {
      const displayName = options.screen;
      const format = options.format || 'jpg';
      const tmpPath = temp.path({
        suffix: `.${format}`,
      });
      const imgPath = path.resolve(options.filename || tmpPath);

      const displayChoice = displayName ? ` /d "${displayName}"` : '';

      exec(
        `"${path.join(libPath, 'screenCapture_1.3.2.bat')}" "${imgPath}" ${displayChoice}`,
        {
          cwd: libPath,
        },
        (err) => {
github web-pal / chronos-timetracker / app / renderer / sagas / screenshots.js View on Github external
const snapshotFunc = () => {
        switch (process.platform) {
          case 'darwin':
            return screenshot.darwinSnapshot;
          case 'win32':
          case 'windows':
            return screenshot.windowsSnapshot;
          default:
            return screenshot;
        }
      };
      const images = yield eff.all(

screenshot-desktop

Capture a screenshot of your local machine

MIT
Latest version published 10 months ago

Package Health Score

62 / 100
Full package analysis