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

hongfangze-proc

v1.1.2

Published

comm.proc

Readme

进程相关操作

介绍

开始使用

npm install hongfangze-proc

import * as proc from 'hongfangze-proc';
// import {id,pid,sleep,pm2,cluster} from 'hongfangze-proc';

/**
 * 16进制进程id
 */
export declare const id: string;
/**
 * 进程id
 */
export declare const pid: number;
/**
 * 休眠指定的毫秒数
 * @param {number} ms
 * @return {*}  {Promise<void>}
 */
export declare const sleep: (ms: number) => Promise<void>;
/**
 * PM2进程管理器帮助类
 * @param {number} ms
 * @return {*}  {Promise<void>}
 */
export declare const pm2: {
    /**
     * 是否主进程
     * @return {*}  {boolean}
     */
    readonly master: boolean;
    /**
     * 是否主进程
     * @return {*}  {boolean}
     */
    isMaster: () => boolean;
    /**
     * 进程详情
     * @return {*}  {boolean}
     */
    workerInstance: () => {
        isMaster: boolean;
        no: string;
        pid: number;
        pid16: string;
    };
};
/**
 * 启动新进程(可用作集群)
 * - 目前有一个缺点,主进程(第一个)挂掉后,自动重启的进程无法认为是主进程,主进程上有监听怎么办
 * @param {string} file 可执行文件绝对路径
 * @param {any[]} [params] 参数列表,默认空数组
 * @param {number} [length] 进程个数 (调试状态该参数无效) 默认为CPU核心数
 * @param {boolean} [autofork] 子进程异常或退出后,是否自动重启 (调试状态、单个进程该参数无效) 默认 true
 * @return {*}  {Promise<typeof $cluster>}
 */
export declare const cluster: (file: string, params?: any[], length?: number, autofork?: boolean) => Promise<typeof $cluster>;
/**
 * 运行命令
 * - 成功返回命令运行后的返回值
 * - 失败将抛出异常
 * @param {string} cmd
 * @param {string[]} params
 * @return {*}  {string}
 */
export declare const runCommand: (cmd: string, params: string[]) => string;

版本迭代记录

2025-10-15 v1.1.2

  • 修复已知Bug。

2025-04-21 v1.1.1

  • 修复已知Bug。

2025-04-18 v1.1.0

  • 增加函数runCommand,封装后处理了乱码的问题。

2025-04-09 v1.0.0

  • 被移除后更名发布。

2025-03-18 v0.1.0

  • 增加pm2类的master的属性访问器。
  • 增加readme文档。
  • 使用新的打包方式发布。