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

window-extra

v1.2.5

Published

node-window增强

Downloads

2

Readme

🚀 window-extra

1. Installation

npm i window-extra

2. Usage

const windowExtra = require("window-extra")

3. API

lockComputer

锁定电脑,锁定后启动电脑需要输入密码

windowExtra.lockComputer()

standbyComputer

关闭计算机并将其置于待机模式

  • isForce <boolean>
    • false, 默认
    • true, 系统将被迫进入待机模式,而无需请求所有应用程序的许可。
windowExtra.standbyComputer()
windowExtra.standbyComputer(true)

sleepComputer

关闭计算机并将其置于睡眠模式

  • isForce <boolean>
    • false, 默认
    • true, 系统将被迫进入待机模式,而无需请求所有应用程序的许可。
windowExtra.sleepComputer()
windowExtra.sleepComputer(true)

rebootComputer

重启电脑

  • seconds <number>
    • 默认 0
    • seconds秒后进入睡眠
windowExtra.rebootComputer(10)

closeComputer

关机

  • seconds <number>
    • 默认 0
    • seconds秒后关机
windowExtra.closeComputer(10)

clearClip

清空剪贴板

windowExtra.clearClip()

copyText2Clip

将指定的文本设置到剪贴板中

  • text <string>
    • 要复制到剪切板的文本
windowExtra.copyText2Clip("fengtianxi001")

copyFileContent2Clip

将指定文本文件的内容设置到剪贴板

  • filePath <string>
    • 文本文件的路径
windowExtra.copyFileContent2Clip("c:\\temp\\test.txt")

writeFileFromClip

将剪贴板的内容写入一个文件(仅支持文本)

  • filePath <string>
    • 文本文件的路径
windowExtra.writeFileFromClip("c:\\temp\\test.txt")

appendFileFromClip

将剪贴板的内容追加到文件中。(仅支持文本)

  • filePath <string>
    • 文本文件的路径
windowExtra.appendFileFromClip("c:\\temp\\test.txt")

saveImageFromClip

将剪贴板中的当前图像保存到文件中

  • imgPath <string>
    • 图像的保存路径
windowExtra.saveImageFromClip("c:\\temp\\test.png")

copyImage2Clip

将指定图像复制到剪贴板。

  • imgPath <string>
    • 图像的路径
windowExtra.copyImage2Clip("c:\\temp\\test.png")

sendMouse

设置鼠标光标相对于屏幕的左上角的位置

  • x <number>
    • 鼠标的横坐标
  • y <number>
    • 鼠标的纵坐标
windowExtra.sendMouse(100,100)

setsMousewin

设置鼠标光标相对于活动窗口左上角的位置

  • x <number>
    • 鼠标的横坐标
  • y <number>
    • 鼠标的纵坐标
windowExtra.setsMousewin(100,100)

moveMouse

设置鼠标光标相对与现在的位置的位置

  • x <number>
    • 鼠标的横坐标
  • y <number>
    • 鼠标的纵坐标
windowExtra.moveMouse(100,100)

moveMouse

滚动鼠标滚轮

  • distance <number>
    • 默认1200
    • 滚轮的滚动距离
    • 在标准鼠标下distance 需要是120的倍数
windowExtra.moveMouse(2400)

setVolume

设置系统音量

  • value <number>
    • 默认25000
    • 静音:0 最大音量:65535
windowExtra.setVolume(65000)

playMusic

播放音频

  • playTime <\number> <unit: millisecond>

    • 默认10000
    • 音频的播放时长
  • audioFile <string>

    • 音频文件的路径
windowExtra.playMusic(10000,"c:\\temp\\1.mp3")

showMessage

消息通知

  • message<string>

    • 默认 ""
    • 通知的消息内容
  • title<string>

    • 默认 ""
    • 通知的标题内容
windowExtra.showMessage("hello word","notify")

sendkey

模拟单个按键的操作

  • key <string>
    • 默认 enter
    • 按键名称
  • active <enum><string>
    • ["down"|"up"|"press"]
windowExtra.sendkey("a","press") 
windowExtra.sendkey("shift","down") 
windowExtra.sendkey("f10","press") 
windowExtra.sendkey("0x2e","press")

runProgram

执行程序

  • program <string>
    • 执行程序的路径
windowExtra.runProgram("c:\\program files\\my software\\abc.exe" ) 

closeScreen

关闭屏幕

windowExtra.closeScreen() 

openScreen

打开屏幕

windowExtra.openScreen() 

lowPowerScreen

将显示器设置为低功耗状态

windowExtra.lowPowerScreen() 

saverScreen

启动默认屏幕保护程序(没设置屏保,无效)

windowExtra.saverScreen() 

setPrimaryScreen

设置主屏幕,仅适用于具有多个屏幕的系统

  • monitorIndex <number>
    • 屏幕序号
windowExtra.setPrimaryScreen(1) 

setScreenBrightness

调整屏幕亮度

  • level <number>

    • 最大值 100 ,非常亮
    • 最小值 0 ,非常暗
  • mode <number>

    • 1, 调整外接电源使用环境下的亮度
    • 2, 调整电池使用环境下的亮度
    • 3, 二者同时更改
windowExtra.setScreenBrightness(50,1)