npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@cc-kit/node-screenshots

v2.0.1

Published

`node-screenshots` is a native node.js screenshot library based on [XCap](https://github.com/nashaofu/xcap), It supports Mac, Windows, and Linux systems without any dependencies. `node-screenshots` supports screenshot and video recording (to be implemente

Readme

📸 node-screenshots

node-screenshots is a native node.js screenshot library based on XCap, It supports Mac, Windows, and Linux systems without any dependencies. node-screenshots supports screenshot and video recording (to be implemented).

English | 简体中文

Support Matrix

Operating System

| Operating System | node16 | node18 | node20 | | ---------------- | ------ | ------ | ------ | | Windows x64 | ✓ | ✓ | ✓ | | Windows x32 | ✓ | ✓ | ✓ | | Windows arm64 | ✓ | ✓ | ✓ | | macOS x64 | ✓ | ✓ | ✓ | | macOS arm64 | ✓ | ✓ | ✓ | | Linux x64 gnu | ✓ | ✓ | ✓ | | Linux x64 musl | ✓ | ✓ | ✓ |

Example

Monitor

const fs = require("fs");
const { Monitor } = require("node-screenshots");

let monitor = Monitor.fromPoint(100, 100);

console.log(monitor, monitor.id());

let image = monitor.captureImageSync();
fs.writeFileSync(`${monitor.id()}-sync.png`, image.toPngSync());

monitor.captureImage().then((data) => {
  console.log(data);
  fs.writeFileSync(`${monitor.id()}.jpeg`, data.toJpegSync());
});

const monitors = Monitor.all();

monitors.forEach((item) => {
  console.log(
    "Monitor:",
    item.id(),
    item.name(),
    [item.x(), item.y(), item.width(), item.height()],
    item.rotation(),
    item.scaleFactor(),
    item.frequency(),
    item.isPrimary()
  );
});

Window

const fs = require("fs");
const { Window } = require("node-screenshots");

let windows = Window.all();

windows.forEach((item) => {
  console.log({
    id: item.id(),
    x: item.x(),
    y: item.y(),
    y: item.z(),
    width: item.width(),
    height: item.height(),
    rotation: item.rotation(),
    scaleFactor: item.scaleFactor(),
    isPrimary: item.isPrimary(),
  });

  let image = item.captureImageSync();
  fs.writeFileSync(`${item.id()}-sync.bmp`, image.toBmpSync());

  item.captureImage().then(async (data) => {
    console.log(data);
    let newImage = await data.crop(10, 10, 10, 10);
    fs.writeFileSync(`${item.id()}.png`, await newImage.toPng());
  });
});

API

Full typeScript type definition: index.d.ts

Monitor

  • static all(): Array<Monitor>: Get all monitor
  • static fromPoint(x: number, y: number): Monitor | null: Get a monitor from the specified coordinates
  • captureImageSync(): Image: Synchronously capture image
  • captureImage(): Promise<Image>: Asynchronously capture image

Window

  • static all(): Array<Window>: Get all window
  • captureImageSync(): Image: Synchronously capture image
  • captureImage(): Promise<Image>: Asynchronously capture image

Image

  • cropSync(x: number, y: number, width: number, height: number): Image: Synchronously crop image
  • crop(x: number, y: number, width: number, height: number): Promise<Image>: Asynchronously crop image
  • toPngSync(copyOutputData?: boolean | undefined | null): Buffer:Synchronously Convert to png
  • toPng(copyOutputData?: boolean | undefined | null): Promise<Buffer>: Asynchronously Convert to png
  • toJpegSync(copyOutputData?: boolean | undefined | null): Buffer: Synchronously Convert to jpeg
  • toJpeg(copyOutputData?: boolean | undefined | null): Promise<Buffer>: Asynchronously Convert to jpeg
  • toBmpSync(copyOutputData?: boolean | undefined | null): Buffer: Synchronously Convert to bmp
  • toBmp(copyOutputData?: boolean | undefined | null): Promise<Buffer>: Asynchronously Convert to bmp
  • toRawSync(copyOutputData?: boolean | undefined | null): Buffer: Synchronously Convert to raw(RGBA data)
  • toRaw(copyOutputData?: boolean | undefined | null): Promise<Buffer>: Asynchronously Convert to raw(RGBA data)

copyOutputData: pass related parameters in electron, otherwise electron will crash, nodejs does not pass or passes false, performance will be better, for more information refer to https://github.com/napi-rs/napi-rs/issues/1346

Linux System Requirements

On Linux, you need to install libxcb, libxrandr, and dbus.

Debian / Ubuntu:

apt-get install libxcb1 libxrandr2 libdbus-1-3

Alpine:

apk add libxcb libxrandr dbus

Related Repositories

  • xcap - XCap is a cross-platform screen capture library written in Rust