@guanghechen/helper-fs
Provide some enhanced methods base on node:fs
.
Install
-
npm
npm install --save @guanghechen/helper-fs
-
yarn
yarn add @guanghechen/helper-fs
Usage
Name | Description |
---|---|
collectAllFiles |
(async) Collect all files under the given directory |
collectAllFilesSync |
Collect all files under the given directory (synchronizing) |
emptyDir |
(async) Remove all files under the given directory path. |
ensureCriticalFilepathExistsSync |
Ensure critical filepath exists |
isDirectorySync |
Check whether if the dirpath is a directory path |
isFileSync |
Check whether if the filepath is a file path |
isNonExistentOrEmpty |
Check whether if the dirPath is a non-existent path or empty folder |
mkdirsIfNotExists |
Create a path of directories |
writeFile |
Same as the writeFile method provided in node:fs/promises , except that it will ensure that the parent path exists. |