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

desktop-screenshot

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

desktop-screenshot

Cross-platform screenshot module, using external tools

  • 0.1.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
26K
decreased by-8.25%
Maintainers
1
Weekly downloads
 
Created
Source

node-desktop-screenshot

Take a screenshot of the computer on which Node is running, using platform-specific external tools included with the package

Supports Windows (win32), OSX (darwin) and Linux platforms

Windows version uses nircmd (http://nircmd.nirsoft.net) Linux version uses scrot

Available Options

  • quality: JPEG quality (0 to 100)
  • width: use in conjunction with height, or by itself to maintain aspect ratio
  • height: use in conjunction with width, or by itself to maintain aspect ratio

Examples

Full resolution

var screenshot = require('desktop-screenshot');

screenshot("screenshot.png", function(error, complete) {
    if(error)
        console.log("Screenshot failed", error);
    else
        console.log("Screenshot succeeded");
});

Resize to 400px wide, maintain aspect ratio

var screenshot = require('desktop-screenshot');

screenshot("screenshot.png", {width: 400}, function(error, complete) {
    if(error)
        console.log("Screenshot failed", error);
    else
        console.log("Screenshot succeeded");
});

Resize to 400x300, set JPG quality to 60%

var screenshot = require('desktop-screenshot');

screenshot("screenshot.jpg", {width: 400, height: 300, quality: 60}, function(error, complete) {
    if(error)
        console.log("Screenshot failed", error);
    else
        console.log("Screenshot succeeded");
});

TODOs

  • Tests
  • Multi-screen support
  • Cropping
  • Return contents of image, rather than writing file

FAQs

Package last updated on 28 Aug 2016

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