# @gosavetool/text 中文文档

规范地址：https://npmcn.com/package/%40gosavetool/text/

版本：1\.0\.0
npm 元数据更新时间：2026-11-01T05:24:33.767Z
中文译文更新时间：2026-11-01T06:32:42.766Z
软件包许可：MIT

本文由上游 README 机器翻译，可能存在偏差，请结合原文核对 API、命令与配置。版权与许可归原作者所有。

原始 npm 页面：https://www.npmjs.com/package/%40gosavetool/text
原文对照：https://npmcn.com/package/%40gosavetool/text/?lang=original
项目主页：https://www.gosavetool.com/character-counter
源码仓库：https://github.com/mitolocya/gosavetool

## 关键信息（来自 npm 元数据）

- 包体积（解压后）：9 kB，5 个文件
- 模块格式：CommonJS
- TypeScript 类型：包内自带
- Node.js 要求：\>=14
- 运行依赖：0 个
- 首次发布：2026-11-01T05:23:37.526Z
- 最新版本发布：2026-11-01T05:24:33.589Z
- 已发布版本数：2（近 12 个月 2 个）

## 中文简介

字数，阅读时间，社交媒体字符限制，标题大小写，鼻涕虫（土耳其语和重音字母）和空白清理。零依赖关系。

## 安装

```sh
npm install @gosavetool/text
```

也可以使用：`pnpm add @gosavetool/text`、`yarn add @gosavetool/text`、`bun add @gosavetool/text`

## README

# @gosavetool /文本

没有依赖的小文本助手：单词和字符计数，阅读时间，社交媒体字符限制，大小写更改，URL标记和空白清理。

由 [GoSaveTool](https://www.gosavetool.com/)． 不需要代码吗？试 [字符计数器](https://www.gosavetool.com/character-counter).

## 安装

```bash
npm install @gosavetool/text
```

## 计数和阅读时间

```js
const { stats } = require('@gosavetool/text');

stats('Hello world. It’s 2026!');
// { words: 4, chars: 23, charsNoSpaces: 20, lines: 1, sentences: 2, readSeconds: 1 }
```

阅读时间为每分钟238个单词，这是非小说类读物的平均默读速度。

## 社交媒体和SEO限制

```js
const { limits } = require('@gosavetool/text');

limits(caption, ['x-post', 'instagram-caption']);
// { 'x-post': { limit: 280, used: 312, left: -32, fits: false }, 'instagram-caption': { … fits: true } }
```

| 名字 | 限制 |
| --- | --- |
| `x-post` | 280 |
| `instagram-caption` | 2200年 |
| `tiktok-caption` | 4000年 |
| `youtube-title` | 100 |
| `youtube-description` | 5000年 |
| `linkedin-post` | 3，000 |
| `pinterest-description` | 500 |
| `seo-title` | 60 |
| `meta-description` | 160 |

## 套管和段塞

```js
const t = require('@gosavetool/text');

t.title('the lord of the rings: return of the king'); // 'The Lord of the Rings: Return of the King'
t.sentence('HELLO WORLD. how ARE you?');               // 'Hello world. How are you?'
t.slug('Ölçü Birimi & Çeviri!');                       // 'olcu-birimi-ceviri'
t.camel('best posting time');                          // 'bestPostingTime'
t.snake('bestPostingTime');                            // 'best_posting_time'
t.kebab('Best Posting_Time');                          // 'best-posting-time'
t.clean('a   b  \n\n\n\nc');                            // 'a b\n\nc'
```

`slug()` 将土耳其语（' ',' ',' ‘ ‘，ç， ö， ü），德语（’ ’）和重音字母转换为纯ASCII。

包括TypeScript类型。

## 相关

-   [酷文本生成器](https://www.gosavetool.com/cool-text-generator)： bios的花哨的Unicode字体
-   [@gosavetool /字幕](https://www.npmjs.com/package/@gosavetool/subtitles)： SRT和WebVTT工具
-   VS代码: [GoSaveTool扩展](https://marketplace.visualstudio.com/items?itemName=gosavetool.gosavetool)，状态栏中的字数统计

## 许可证

麻省理工学院

## 常见问题

### @gosavetool/text 是什么？

字数，阅读时间，社交媒体字符限制，标题大小写，鼻涕虫（土耳其语和重音字母）和空白清理。零依赖关系。

### 如何安装 @gosavetool/text？

在项目目录运行 npm install @gosavetool/text，或使用 pnpm add / yarn add / bun add。

### @gosavetool/text 支持 TypeScript 吗？

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

### @gosavetool/text 支持 ESM 还是 CommonJS？

以 CommonJS 形式发布，可以直接 require\(\)；在 ES Module 项目中也可以用 import 引入（Node\.js 会把 module\.exports 作为默认导出）。

### @gosavetool/text 需要什么版本的 Node\.js？

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

### @gosavetool/text 可以商用吗？

@gosavetool/text 使用 MIT 许可。宽松许可：允许商业使用、修改和再分发，通常只需在分发时保留原版权与许可声明。以上为概括，不构成法律意见，请以许可原文为准。

### @gosavetool/text 还在维护吗？

最新版本 1\.0\.0 发布于 2026/11/01（2 天前）；至今共发布 2 个版本，其中过去 12 个月发布了 2 个；首次发布于 2026/11/01。发布频率只是参考信号：功能稳定的工具可能很少需要更新，建议结合源码仓库的 issue 和提交记录判断。

