Promise fs based on node.js fs
npm install @jiaminghi/fs- stat
读取文件状态
- mkDir
创建文件夹
- access
连接文件
- copyDir
复制文件夹到指定位置,若文件夹已存在将被清空后进行复制操作
- readDir
读取文件夹
- clearDir
递归清空文件夹,若文件夹不存在将被创建
- emptyDir
递归清空文件夹
- readFile
读取文件
写入文件
遍历文件夹
递归遍历文件
递归删除指定 extname 的文件
``shell`
$ npm install @jiaminghi/fs
`javascript
import { readFile } from '@jiaminghi/fs'
// do something
`
#### stat
`typescript`
type stat = (
path: fs.PathLike,
options: fs.StatOptions = { bigint: false }
) => Promise
#### mkDir
`typescript`
type mkDir = (path: fs.PathLike, options: fs.MakeDirectoryOptions = {}) => Promise
#### access
`typescript`
type access = (path: fs.PathLike, mode = fs.constants.F_OK) => Promise
#### copyDir
`typescript`
type copyDir = (path: fs.PathLike, dest: string) => Promise
#### readDir
`typescript`
type readDir = (path: fs.PathLike) => Promise
#### clearDir
`typescript`
type clearDir = (path: fs.PathLike) => Promise
#### emptyDir
`typescript`
type emptyDir = (path: fs.PathLike) => Promise
#### readFile
`typescript`
type readFile = (
path: fs.PathLike,
options: { encoding: string; flag?: string } = { encoding: 'utf8' }
) => Promise
#### writeFile
`typescript`
type writeFile = (
path: fs.PathLike,
data: any,
option: fs.WriteFileOptions = 'utf8'
) => Promise
#### dirForEach
`typescript`
type dirForEach = (path: fs.PathLike, callback: (path: string) => any) => Promise
#### fileForEach
`typescript`
type fileForEach = (path: fs.PathLike, callback: (path: string) => any) => Promise
#### unlinkDirFileByExtname
`typescript``
type unlinkDirFileByExtname = (path: fs.PathLike, extnames: string[] = []) => Promise