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

text-server

v1.0.0

Published

文本剪切板

Readme

text-server

一个零依赖的局域网文本传输工具。在本地启动一个 HTTP 服务,用手机或其他设备的浏览器打开,即可将文本保存到本机——跨设备的「文本剪切板」。

使用场景

  • 手机复制了一段文本,想快速传到电脑上
  • 同一局域网内设备间传递代码片段、链接、笔记等
  • 不想登录微信/邮件来传一段文字

快速开始

npx text-server

启动后终端会显示局域网地址,例如:

==================================================
  📋 文本传输服务已启动
==================================================

  本机访问:  http://localhost:8765
  局域网访问: http://192.168.1.100:8765
  👆 在另一台设备浏览器中打开上面的地址

  保存目录: /your/cwd/received_texts
  按 Ctrl+C 停止服务

在另一台设备的浏览器中打开局域网地址,粘贴文本,点击保存即可。

指定端口

npx text-server 3000

默认端口为 8765,如端口被占用会自动提示。

功能特性

  • 零依赖 — 仅使用 Node.js 内置模块,无需安装任何第三方包
  • 局域网自动发现 — 启动时自动检测并显示局域网 IP 地址
  • 自定义文件名 — 可指定文件名保存,留空则按时间戳自动命名(如 20260715_143022.txt
  • 同名文件保护 — 文件名冲突时自动追加编号(note_1.txtnote_2.txt
  • 文件名安全过滤 — 自动移除文件名中的非法字符
  • 保存历史 — 页面底部展示最近 20 条已保存文件记录(文件名、大小、时间)
  • 深色主题 UI — 适配移动端,在手机浏览器上也有良好的操作体验
  • XSS 防护 — 用户输入经 HTML 转义后再渲染

保存位置

文本文件保存在当前工作目录下的 received_texts/ 文件夹中:

./received_texts/
├── 20260715_143022.txt
├── my_note.txt
└── code_snippet.js

工作原理

┌──────────────┐    HTTP POST     ┌──────────────┐    writeFileSync    ┌──────────────┐
│  手机浏览器   │  ─────────────▶  │  text-server │  ────────────────▶  │  本地文件     │
│  粘贴文本     │                  │  (Node.js)   │                     │  ./received_  │
│  点击保存     │  ◀─────────────  │              │                     │  texts/       │
└──────────────┘   303 Redirect    └──────────────┘                     └──────────────┘
  1. 在本机启动 HTTP 服务,监听 0.0.0.0(所有网卡)
  2. 远程设备浏览器访问该服务,看到文本输入页面
  3. 输入/粘贴文本,可选填文件名,提交表单
  4. 服务端将文本保存为文件,重定向回首页并显示保存结果

要求

  • Node.js >= 14(使用了 URLSearchParamsfs.mkdirSync({ recursive }) 等 API)

开发

git clone https://github.com/jayli/text-server.git
cd text-server
node index.js          # 启动服务
node index.js 9000     # 指定端口

License

ISC