# @-xun/fs 中文文档

规范地址：https://npmcn.com/package/%40-xun/fs/

版本：2\.0\.0
npm 元数据更新时间：2025-05-31T21:18:55.417Z
中文译文更新时间：2026-11-05T17:30:33.941Z
软件包许可：MIT

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

原始 npm 页面：https://www.npmjs.com/package/%40-xun/fs
原文对照：https://npmcn.com/package/%40-xun/fs/?lang=original
项目主页：https://github.com/Xunnamius/fs-utils#readme
源码仓库：https://github.com/Xunnamius/fs-utils

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

- 包体积（解压后）：21.6 kB，5 个文件
- 模块格式：CommonJS
- TypeScript 类型：包内自带
- Node.js 要求：^20\.18\.0 \|\| ^22\.12\.0 \|\| \>=23\.3\.0
- 运行依赖：1 个
- 首次发布：2025-01-23T02:59:31.269Z
- 最新版本发布：2025-05-31T21:18:55.217Z
- 近 30 天下载量：286464（2026-10-04 至 2026-11-02，npm 官方下载统计）
- 已发布版本数：2（近 12 个月 0 个）

## 中文简介

输入文件系统交互工具

## 安装

```sh
npm install @-xun/fs
```

也可以使用：`pnpm add @-xun/fs`、`yarn add @-xun/fs`、`bun add @-xun/fs`

## README

![](https://raw.githubusercontent.com/Xunnamius/fs-utils/refs/heads/main/logo.png)

输入文件系统交互工具

* * *

[![Black Lives Matter!](https://xunn.at/badge-blm "Join the movement!")](https://xunn.at/donate-blm) [![Last commit timestamp](https://img.shields.io/github/last-commit/Xunnamius/fs-utils?style=flat-square "Latest commit timestamp")](https://github.com/Xunnamius/fs-utils) [![Codecov](https://img.shields.io/codecov/c/github/Xunnamius/fs-utils/main?style=flat-square&token=HWRIOBAAPW&flag=package.main_root "Is this package well-tested?")](https://codecov.io/gh/Xunnamius/fs-utils) [![Source license](https://img.shields.io/npm/l/@-xun/fs?style=flat-square "This package's source license")](https://github.com/Xunnamius/fs-utils/blob/main/LICENSE) [![Uses Semantic Release!](https://xunn.at/badge-semantic-release "This repo practices continuous integration and deployment!")](https://github.com/semantic-release/semantic-release)

[![NPM version](https://xunn.at/npm-pkg-version/@-xun/fs "Install this package using npm or yarn!")](https://npm.im/@-xun/fs) [![Monthly Downloads](https://img.shields.io/npm/dm/@-xun/fs?style=flat-square "Number of times this package has been downloaded per month")](https://npmtrends.com/@-xun/fs)

  

# fs-utils (@-xun/fs) (英语)

输入的文件系统交互工具 .

* * *

-   [安装](https://npmcn.com/package/%40-xun/fs/#readme-install)
-   [使用量](https://npmcn.com/package/%40-xun/fs/#readme-usage)
-   [附 录](https://npmcn.com/package/%40-xun/fs/#readme-appendix)
    -   [已发布软件包细节](https://npmcn.com/package/%40-xun/fs/#readme-published-package-details)
    -   [许可证](https://npmcn.com/package/%40-xun/fs/#readme-license)
-   [捐助和支助](https://npmcn.com/package/%40-xun/fs/#readme-contributing-and-support)
    -   [贡献者](https://npmcn.com/package/%40-xun/fs/#readme-contributors)

  

## 安装

要安装 :

```shell
npm install @-xun/fs
```

## 使用量

开始

## 附 录

进一步文件见下面 [`docs/`](https://npmcn.com/package/%40-xun/fs/docs)。 。 。 .

### 已发布软件包细节

这是一个 [CJS2 软件包](https://dev.to/jakobjingleheimer/configuring-commonjs-es-modules-for-nodejs-12ed#publish-only-a-cjs-distribution-with-property-exports) 有静态分析的出口 由 Babel 所建,用于Node.js 版本中不为报废. 对于 TypeScript 用户, 此软件包支持两者 `"Node10"` 财务报告和审定财务报表 `"Node16"` 模块 决议战略.

扩展细节

这意味着CJS2(通过 `require(...)`和无害环境管理(通过 `import { ... } from ...` 或者说 `await import(...)`) 源会从相同的切入点装入此包 当使用节点时。 这有几个好处,首先是: 代码少一点 已运出/ 较小的软件包大小, 避免 [双套件 危险](https://nodejs.org/api/packages.html#dual-package-hazard) 完全,分配不是 包装/捆绑/放大,一个复杂程度大大降低的建造过程,以及CJS 消费者不是被骗的.

每个出入口(即:. `ENTRY`(单位:千美元) [`package.json`是因为 `exports[ENTRY]`](https://npmcn.com/package/%40-xun/fs/package.json) 对象包括一个或多个 [导出 条件](https://webpack.js.org/guides/package-exports#reference-syntax)。这些条目可能包括也可能不包括: [`exports[ENTRY].types`](https://devblogs.microsoft.com/typescript/announcing-typescript-4-5-beta#packagejson-exports-imports-and-self-referencing) 指向类型的条件 typeScript 和 IDEs 的声明文件, a [`exports[ENTRY].module`](https://webpack.js.org/guides/package-exports#providing-commonjs-and-esm-version-stateless) 条件指向 (通常是无害环境管理) Webpack/Rollup 源,a `exports[ENTRY].node` 和(或) `exports[ENTRY].default` 指向(通常是CJS2)节点源的条件 `require`编号 :`import` 用于浏览器和其他环境,以及 [其他项目 条件](https://webpack.js.org/guides/package-exports#reference-syntax) 这里没有列出。 检查 [软件包.json](https://npmcn.com/package/%40-xun/fs/package.json) 要查看哪些导出条件的文件 已支持.

请注意,无论 [`{ "type": "..." }`](https://github.com/nodejs/node/blob/8d8e06a345043bec787e904edc9a2f5c5e9c275f/doc/api/packages.md#type) 指定于 [`package.json`](https://npmcn.com/package/%40-xun/fs/package.json),任何在无害环境管理中写的 JavaScript 文件 语法(包括分配)将永远具有 `.mjs` 扩展名。 说明 并且 [`package.json`](https://npmcn.com/package/%40-xun/fs/package.json) 可能包括 [`sideEffects`](https://webpack.js.org/guides/tree-shaking#mark-the-file-as-side-effect-free) 键,几乎总是 `false` 页:1 最佳 [树摇晃](https://webpack.js.org/guides/tree-shaking) 在适当情况下.

### 许可证

见 [自由主义](https://npmcn.com/package/%40-xun/fs/LICENSE)。 。 。 .

## 捐助和支助

**[二. 新问题](https://github.com/Xunnamius/fs-utils/issues/new/choose) 财务报告和审定财务报表 [拖动请求](https://github.com/Xunnamius/fs-utils/compare) 永远欢迎和赞赏** 你也一样 [明星们.. 这个项目](https://github.com/Xunnamius/fs-utils) 让我知道你觉得有用! 或者说 [购买 给我一瓶啤酒](https://github.com/sponsors/Xunnamius)我会很感激的 谢谢!

见 [捐款额](https://npmcn.com/CONTRIBUTING.md) 财务报告和审定财务报表 [支助](https://npmcn.com/.github/SUPPORT.md) 页:1 更多信息.

### 贡献者

[![All Contributors](https://img.shields.io/badge/all_contributors-1-orange.svg?style=flat-square)](https://npmcn.com/package/%40-xun/fs/#readme-contributors-)

感谢这些伟大的人[爱莫吉 键](https://allcontributors.org/docs/en/emoji-key):

<table><tbody><tr><td align="center"><a href="https://xunn.io/" rel="nofollow noopener noreferrer"><img alt="Bernard" src="https://avatars.githubusercontent.com/u/656017?v=4?s=100" width="100px;" loading="lazy" decoding="async" referrerpolicy="no-referrer"><br><sub><b>伯纳德</b></sub></a><br><a href="https://npmcn.com/package/%40-xun/fs/#readme-infra-Xunnamius" title="Infrastructure (Hosting, Build-Tools, etc)" rel="nofollow noopener noreferrer">🚇</a> <a href="https://github.com/Xunnamius/fs-utils/commits?author=Xunnamius" title="Code" rel="nofollow noopener noreferrer">💻</a> <a href="https://github.com/Xunnamius/fs-utils/commits?author=Xunnamius" title="Documentation" rel="nofollow noopener noreferrer">📖</a> <a href="https://npmcn.com/package/%40-xun/fs/#readme-maintenance-Xunnamius" title="Maintenance" rel="nofollow noopener noreferrer">🚧</a> <a href="https://github.com/Xunnamius/fs-utils/commits?author=Xunnamius" title="Tests" rel="nofollow noopener noreferrer">⚠️</a> <a href="https://github.com/Xunnamius/fs-utils/pulls?q=is%3Apr+reviewed-by%3AXunnamius" title="Reviewed Pull Requests" rel="nofollow noopener noreferrer">👀</a></td></tr></tbody><tfoot><tr><td align="center" colspan="7"><img src="https://raw.githubusercontent.com/all-contributors/all-contributors-cli/1b8533af435da9854653492b1327a23a4dbd0a10/assets/logo-small.svg" loading="lazy" decoding="async" referrerpolicy="no-referrer"> <a href="https://all-contributors.js.org/docs/en/bot/usage" rel="nofollow noopener noreferrer">添加您的贡献</a></td></tr></tfoot></table>

本项目遵循 [全部贡献者](https://github.com/all-contributors/all-contributors) 规格。 任何捐款都欢迎!

## 常见问题

### @-xun/fs 是什么？

输入文件系统交互工具

### 如何安装 @-xun/fs？

在项目目录运行 npm install @-xun/fs，或使用 pnpm add / yarn add / bun add。

### @-xun/fs 支持 TypeScript 吗？

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

### @-xun/fs 支持 ESM 还是 CommonJS？

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

### @-xun/fs 需要什么版本的 Node\.js？

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

### @-xun/fs 可以商用吗？

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

### @-xun/fs 的下载量有多少？

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

### @-xun/fs 还在维护吗？

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

