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

@idlebox/named-pipe

v0.0.3

Published

1. 在windows上使用 //./pipe/xxx 2. 在linux上使用FIFO

Readme

命名管道读写 兼容windows

  1. 在windows上使用 //./pipe/xxx
  2. 在linux上使用FIFO

作为写入端时,会阻塞直到有读取端连接,读取端随后关闭连接,写入端会收到EPIPE回调,再写入会抛出EPIPE错误。与标准管道行为相同。

作为读取端时,输出流会一直可用,直到程序主动关闭。这与标准的管道行为不同,标准管道在对方(写入端)关闭后我们会收到EOF。(实际就是 tail -f 的行为)

Linux

通过运行tail -f和tee来实现读写。

由于写入时,部分数据被child_process.stdin流缓存,导致读取端丢失后,缓存的这部分数据会被丢弃。这可能不太符合直觉。好在不是常见情况。

Linux 纯js实现(默认不启用)

由于nodejs不能调用同步的open函数,否则会彻底卡死node的核心fs线程。所以在linux上必须使用NONBLOCK。

作为读取端时没有任何问题。

但作为写入端时,如果没有读取端,open会返回ENXIO错误。

会有一个3秒重试等待读取端连接,直到成功为止。可以增加一个inotifywait的实现,不过不支持mac。

Windows

在windows上,管道类似网络套接字,必须先有服务器,且始终都是双向读写,此API模拟只读、只写状态。

当前程序必须明确自己是服务器还是客户端(作为参数传入)。

| ↓ 对管道 \ 我是 → | 服务端 | 客户端 | |----|----|----| | 读 | 打开服务器并等待任意多客户端连接,合并所有输入 | 连接到服务器并读取数据 | | 写 | 打开服务器并随机发送给其中一个客户端 | 连接到服务器并写入数据 |

作为客户端时,如果服务器不存在,和linux一样会有重试直到成功的逻辑。