Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

screenshot-desktop

Package Overview
Dependencies
Maintainers
1
Versions
34
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

screenshot-desktop

Capture a screenshot of your local machine

  • 1.15.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
80K
increased by5.21%
Maintainers
1
Weekly downloads
 
Created
Source

screenshot-desktop

Capture a screenshot of your local machine

  • Multi/Cross Platform
    • Linux: required ImageMagick apt-get install imagemagick
    • OSX: No dependencies required!
    • Windows: No dependencies required!
  • Promise based API
  • JPG output (by default)

Install

$ npm install --save screenshot-desktop

Usage

const screenshot = require('screenshot-desktop')

screenshot().then((img) => {
  // img: Buffer filled with jpg goodness
  // ...
}).catch((err) => {
  // ...
})
const screenshot = require('screenshot-desktop')

screenshot({format: 'png'}).then((img) => {
  // img: Buffer filled with png goodness
  // ...
}).catch((err) => {
  // ...
})
screenshot.listDisplays().then((displays) => {
  // displays: [{ id, name }, { id, name }]
  screenshot({ screen: displays[displays.length - 1].id })
    .then((img) => {
      // img: Buffer of screenshot of the last display
    });
})
screenshot.all().then((imgs) => {
  // imgs: an array of Buffers, one for each screen
})
screenshot({ filename: 'shot.jpg' }).then((imgPath) => {
  // imgPath: absolute path to screenshot
  // created in current working directory named shot.png
});

// absolute paths work too. so do pngs
screenshot({ filename: '/Users/brian/Desktop/demo.png' })

screenshot() options

  • filename Optional. Absolute or relative path to save output.
  • format Optional. Valid values png|jpg.
  • linuxLibrary Optional. Linux only. Valid values scrot|imagemagick. Which library to use. Note that scrot does not support format or screen selection.

Licence

MIT © Ben Evans

Keywords

FAQs

Package last updated on 13 Jul 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc