-
fs.stat.
-
fs.mkdir.
-
fs.access.
-
Copy the folder to the specified location.
-
fs.readdir.
-
Recursively empty the specified folder.
-
Recursively empty the specified folder.
-
fs.readFile.
-
fs.writeFile.
-
Traverse all folders.
-
Recursively traverse all files.
-
Delete the specified extname file.
$ npm install @jiaminghi/fs
import { readFile } from '@jiaminghi/fs'
// do something
type stat = (
path: fs.PathLike,
options: fs.StatOptions = { bigint: false }
) => Promise<fs.Stats | fs.BigIntStats | false>
type mkDir = (path: fs.PathLike, options: fs.MakeDirectoryOptions = {}) => Promise<boolean>
type access = (path: fs.PathLike, mode = fs.constants.F_OK) => Promise<boolean>
type copyDir = (path: fs.PathLike, dest: string) => Promise<boolean>
type readDir = (path: fs.PathLike) => Promise<string[] | false>
type clearDir = (path: fs.PathLike) => Promise<boolean>
type emptyDir = (path: fs.PathLike) => Promise<boolean>
type readFile = (
path: fs.PathLike,
options: { encoding: string; flag?: string } = { encoding: 'utf8' }
) => Promise<string | false>
type writeFile = (
path: fs.PathLike,
data: any,
option: fs.WriteFileOptions = 'utf8'
) => Promise<boolean>
type dirForEach = (path: fs.PathLike, callback: (path: string) => any) => Promise<boolean>
type fileForEach = (path: fs.PathLike, callback: (path: string) => any) => Promise<boolean>
type unlinkDirFileByExtname = (path: fs.PathLike, extnames: string[] = []) => Promise<boolean>