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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@financial-freedom/electron-screenshot

v1.0.0

Published

基于ElectronJS的截屏工具

Downloads

3

Readme

基于 Electron 开发的截屏软件.

demo

Usage

Prerequisite

全局安装 uglify-js (若已安装, 可忽略该步骤).

npm i -g uglify-js

Install

npm i @financial-freedom/electron-screenshot

Import

/**
 * 主进程 main.js
 */
// 引入模块
const { useCapture } = require('@jsoon/electron-screenshot');

// 创建窗口
const mainWindow = new BrowserWindow({
  // Options
  // ...
});

// 使用截屏
useCapture({
  mainWindow
});

Demo Run

npm run start

Demo Build

# 打包 mac
npm run dist:mac

# 打包 win
npm run dist:win

构建前请先看这里, 解决构建源下载超时的问题.

Features

  • [x] 截屏图片复制到剪切板
  • [x] 截屏选区重置
  • [x] 截屏图片下载
  • [x] 截屏退出
  • [x] 鼠标跟随信息 (当前坐标, 当前屏幕取色)
  • [x] 矩形框工具
  • [x] 椭圆形框工具
  • [x] 箭头工具
  • [x] 画笔工具
  • [x] 马赛克工具 :star_struck:
  • [x] 文字工具
  • [x] 撤销工具 :star_struck:

Issues

Windows 下可能遇到的问题

:warning: 若 canvas 不需要在 Node 环境下运行 (即 Electron 应用主线程), 则无需考虑构建 node-canvas 原生模块构建. 本项目 canvas 运行在渲染进程, 故无需进行原生模块构建.

Windows 下进行 node-canvas 原生模块构建时, 由于 Node, Electron 版本的不同, 可能会导致很多棘手的问题, 这些问题多是涉及到 c++ 和 v8, 因而对于前端开发者而言, 很难定位和解决.

若还不知道如何搭建 node-canvas 原生模块构建环境, 请参考这里.

'toupper': is not a member of 'std'

解决方案如下, 修改 node_modules/canvas/src/util.h 代码:

// Line 31
return c1 == c2 || std::toupper(c1) == std::toupper(c2);

修改为:

// std:: -> ::
return c1 == c2 || ::toupper(c1) == ::toupper(c2);

Canvas.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: class std::shared_ptr<class v8::BackingStore> __cdecl v8::ArrayBuffer::GetBackingStore(void)

解决方案如下, 修改 node_modules/nan/nan_typedarray_contents.h 代码:

// Line 36 - 40
#if (V8_MAJOR_VERSION >= 8)
  data = static_cast<char*>(buffer->GetBackingStore()->Data()) + byte_offset;
#else
  data = static_cast<char*>(buffer->GetContents().Data()) + byte_offset;
#endif

修改为:

// 去掉判断
data = static_cast<char*>(buffer->GetContents().Data()) + byte_offset;

其他相关问题链接

Electron-rebuild canvas 2.6.1 fails on Windows 10: Canvas.obj : error LNK2001: unresolved external symbol

[Bug]: Link error for native c++ modules