human-signals

中文文档
8.0.1发布于 2025/03/29Apache-2.0TypeScriptES Module零依赖近 30 天下载 5.9亿

Human-friendly process signals

原始使用文档
文档目录10 节
  1. signalsByName
  2. signalsByNumber
  3. signal
  4. name
  5. number
  6. description
  7. supported
  8. action
  9. forced
  10. standard

Node TypeScript Codecov Mastodon Medium

Human-friendly process signals.

This is a map of known process signals with some information about each signal.

Unlike os.constants.signals this includes:

Example

import { signalsByName, signalsByNumber } from 'human-signals'

console.log(signalsByName.SIGINT)
// {
//   name: 'SIGINT',
//   number: 2,
//   description: 'User interruption with CTRL-C',
//   supported: true,
//   action: 'terminate',
//   forced: false,
//   standard: 'ansi'
// }

console.log(signalsByNumber[8])
// {
//   name: 'SIGFPE',
//   number: 8,
//   description: 'Floating point arithmetic error',
//   supported: true,
//   action: 'core',
//   forced: false,
//   standard: 'ansi'
// }

Install

npm install human-signals

This package works in Node.js >=18.18.0.

This is an ES module. It must be loaded using an import or import() statement, not require(). If TypeScript is used, it must be configured to output ES modules, not CommonJS.

Usage

signalsByName

Type: object

Object whose keys are signal names and values are signal objects.

signalsByNumber

Type: object

Object whose keys are signal numbers and values are signal objects.

signal

Type: object

Signal object with the following properties.

name

Type: string

Standard name of the signal, for example 'SIGINT'.

number

Type: number

Code number of the signal, for example 2. While most number are cross-platform, some are different between different OS.

description

Type: string

Human-friendly description for the signal, for example 'User interruption with CTRL-C'.

supported

Type: boolean

Whether the current OS can handle this signal in Node.js using process.on(name, handler).

The list of supported signals is OS-specific.

action

Type: string
Enum: 'terminate', 'core', 'ignore', 'pause', 'unpause'

What is the default action for this signal when it is not handled.

forced

Type: boolean

Whether the signal's default action cannot be prevented. This is true for SIGTERM, SIGKILL and SIGSTOP.

standard

Type: string
Enum: 'ansi', 'posix', 'bsd', 'systemv', 'other'

Which standard defined that signal.

Support

For any question, don't hesitate to submit an issue on GitHub.

Everyone is welcome regardless of personal background. We enforce a Code of conduct in order to promote a positive and inclusive environment.

Contributing

This project was made with ❤️. The simplest way to give back is by starring and sharing it online.

If the documentation is unclear or has a typo, please click on the page's Edit button (pencil icon) and suggest a correction.

If you would like to help us fix a bug or add a new feature, please check our guidelines. Pull requests are welcome!

Thanks go to our wonderful contributors:

ehmicky
ehmicky

💻 🎨 🤔 📖
electrovir
electrovir

💻
Felix Zedén Yverås
Felix Zedén Yverås

💻 ⚠️

版本与发布记录

human-signals 共发布 16 个版本,首次发布于 2019/10/13;过去 12 个月发布了 0 个版本。

版本发布日期距今
8.0.1latest2025/03/291.6 年前
8.0.02024/08/042 年前
7.0.02024/05/042 年前
6.0.02023/10/293 年前
5.0.02023/05/143 年前
4.3.12023/03/193 年前

关于 human-signals 的常见问题

human-signals 是什么?

Human-friendly process signals

如何安装 human-signals?

在项目目录运行 npm install human-signals,或使用 pnpm add / yarn add / bun add。

human-signals 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

human-signals 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

human-signals 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=18.18.0。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

human-signals 可以商用吗?

human-signals 使用 Apache-2.0 许可。宽松许可:允许商业使用、修改和再分发,并附带明确的专利授权;分发时需保留许可与 NOTICE 文件,修改过的文件要注明改动。以上为概括,不构成法律意见,请以许可原文为准。

human-signals 的下载量有多少?

根据 npm 官方下载统计,human-signals 在 2026/10/04 – 2026/11/02 这 30 天内被下载 594,956,467 次,日均约 19,831,882 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

human-signals 还在维护吗?

最新版本 8.0.1 发布于 2025/03/29(1.6 年前);至今共发布 16 个版本,其中过去 12 个月发布了 0 个;首次发布于 2019/10/13。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。