{"id":25626889,"url":"https://github.com/DataV-Team/FS","last_synced_at":"2026-06-08T13:30:16.251Z","repository":{"id":42857443,"uuid":"195910775","full_name":"DataV-Team/FS","owner":"DataV-Team","description":"Promisify Node FS API","archived":false,"fork":false,"pushed_at":"2022-03-26T15:15:07.000Z","size":116,"stargazers_count":1,"open_issues_count":4,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-01T16:02:09.243Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/DataV-Team.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-07-09T01:36:40.000Z","updated_at":"2021-05-14T07:09:16.000Z","dependencies_parsed_at":"2022-09-15T02:12:34.382Z","dependency_job_id":null,"html_url":"https://github.com/DataV-Team/FS","commit_stats":null,"previous_names":["jiaming743/fs"],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DataV-Team%2FFS","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DataV-Team%2FFS/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DataV-Team%2FFS/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DataV-Team%2FFS/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DataV-Team","download_url":"https://codeload.github.com/DataV-Team/FS/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240212117,"owners_count":19765963,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-02-22T17:31:50.676Z","updated_at":"2026-06-08T13:30:16.087Z","avatar_url":"https://github.com/DataV-Team.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"[ENGLISH](./README_EN.md)\n\n\u003ch1 align=\"center\"\u003eFS\u003c/h1\u003e\n\n\u003cp align=\"center\"\u003e\n    \u003ca href=\"https://github.com/jiaming743/FS/blob/master/LICENSE\"\u003e\n      \u003cimg src=\"https://img.shields.io/github/license/jiaming743/FS.svg\" alt=\"LICENSE\" /\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://www.npmjs.com/package/@jiaminghi/fs\"\u003e\n      \u003cimg src=\"https://img.shields.io/npm/v/@jiaminghi/fs.svg\" alt=\"LICENSE\" /\u003e\n    \u003c/a\u003e\n\u003c/p\u003e\n\n### 使用 Promise 封装了一些常用的文件系统方法（基于 Node.js 的 fs 文件系统）\n\n- **[stat](#stat)**\n\n  读取文件状态\n\n- **[mkDir](#mkDir)**\n\n  创建文件夹\n\n- **[access](#access)**\n\n  连接文件\n\n- **[copyDir](#copyDir)**\n\n  复制文件夹到指定位置，若文件夹已存在将被清空后进行复制操作\n\n- **[readDir](#readDir)**\n\n  读取文件夹\n\n- **[clearDir](#clearDir)**\n\n  递归清空文件夹，若文件夹不存在将被创建\n\n- **[emptyDir](#emptyDir)**\n\n  递归清空文件夹\n\n- **[readFile](#readFile)**\n\n  读取文件\n\n- **[writeFile](#writeFile)**\n\n  写入文件\n\n- **[dirForEach](#dirForEach)**\n\n  遍历文件夹\n\n- **[fileForEach](#fileForEach)**\n\n  递归遍历文件\n\n- **[unlinkDirFileByExtname](#unlinkDirFileByExtname)**\n\n  递归删除指定 extname 的文件\n\n### npm 安装\n\n```shell\n$ npm install @jiaminghi/fs\n```\n\n### 使用\n\n```javascript\nimport { readFile } from '@jiaminghi/fs'\n\n// do something\n```\n\n\u003ch3 align=\"center\"\u003e示例\u003c/h3\u003e\n\n#### stat\n\n```typescript\ntype stat = (\n  path: fs.PathLike,\n  options: fs.StatOptions = { bigint: false }\n) =\u003e Promise\u003cfs.Stats | fs.BigIntStats | false\u003e\n```\n\n#### mkDir\n\n```typescript\ntype mkDir = (path: fs.PathLike, options: fs.MakeDirectoryOptions = {}) =\u003e Promise\u003cboolean\u003e\n```\n\n#### access\n\n```typescript\ntype access = (path: fs.PathLike, mode = fs.constants.F_OK) =\u003e Promise\u003cboolean\u003e\n```\n\n#### copyDir\n\n```typescript\ntype copyDir = (path: fs.PathLike, dest: string) =\u003e Promise\u003cboolean\u003e\n```\n\n#### readDir\n\n```typescript\ntype readDir = (path: fs.PathLike) =\u003e Promise\u003cstring[] | false\u003e\n```\n\n#### clearDir\n\n```typescript\ntype clearDir = (path: fs.PathLike) =\u003e Promise\u003cboolean\u003e\n```\n\n#### emptyDir\n\n```typescript\ntype emptyDir = (path: fs.PathLike) =\u003e Promise\u003cboolean\u003e\n```\n\n#### readFile\n\n```typescript\ntype readFile = (\n  path: fs.PathLike,\n  options: { encoding: string; flag?: string } = { encoding: 'utf8' }\n) =\u003e Promise\u003cstring | false\u003e\n```\n\n#### writeFile\n\n```typescript\ntype writeFile = (\n  path: fs.PathLike,\n  data: any,\n  option: fs.WriteFileOptions = 'utf8'\n) =\u003e Promise\u003cboolean\u003e\n```\n\n#### dirForEach\n\n```typescript\ntype dirForEach = (path: fs.PathLike, callback: (path: string) =\u003e any) =\u003e Promise\u003cboolean\u003e\n```\n\n#### fileForEach\n\n```typescript\ntype fileForEach = (path: fs.PathLike, callback: (path: string) =\u003e any) =\u003e Promise\u003cboolean\u003e\n```\n\n#### unlinkDirFileByExtname\n\n```typescript\ntype unlinkDirFileByExtname = (path: fs.PathLike, extnames: string[] = []) =\u003e Promise\u003cboolean\u003e\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FDataV-Team%2FFS","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FDataV-Team%2FFS","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FDataV-Team%2FFS/lists"}