graceful-fs / fs-extra wrapper with goodies
$ npm install @valtech-commerce/fs
import { fsAsync, fsSync } from "@valtech-commerce/fs";
fsSync.move("/path1/path2/path3", "/path4");
fsAsync.chmodPattern("/path1/path2/**/*.js", 0o775).then(() => {
console.log("Yeah!");
});
fs
is graceful-fs
fse
is fs-extra
Maps fs.promises.access
Maps fs.promises.chmod
Applies fs.chmod
for matching glob
pattern file/dir.
Required
Type: String
glob pattern.
Required
Type: Number
File mode.
Type: Object
glob options.
Maps fs.promises.chown
Compresses file using gzip
Promise
returns destination
Required
Type: String
Path of file to compress.
Type: String
Default: Same as source with a .gz
added at the end
Path of file when compressed.
Maps fse.copy
Maps fs.promises.copyFile
Decompresses file using gzip
Promise
returns destination
Required
Type: String
Path of file to decompress.
Type: String
Default: Same as source with the .gz
removed at the end
Path of file when decompressed.
Maps fse.emptyDir
Maps fse.ensureDir
Maps fse.ensureFile
Maps fse.ensureLink
Maps fse.ensureSymlink
Maps fs.promises.lchmod
Maps fs.promises.lchown
Maps fs.promises.link
Maps fs.promises.lstat
Merge multiple files into a single file
Required
Type: Array
of String
Path of files to merge.
Required
Type: String
Path of merged file. (If it ends with .gz
it will be compressed using gzip)
Maps fs.promises.mkdir
Maps fse.mkdirp
Maps fse.mkdirs
Maps fs.promises.mkdtemp
Maps fse.move
Maps fs.promises.open
Almost the same as writeCompressed, except that if the directory does not exist, it's created.
Required
Type: String
Path of file to write.
Required
Type: String
Content to write.
Maps fse.outputFile
Almost the same as writeJson, except that if the directory does not exist, it's created.
Required
Type: String
Path of file to write. (If it ends with .gz
it will be compressed using gzip)
Required
Type: Object
Object to write.
Type: Function
JSON.stringify replacer.
Type: String
or Number
JSON.stringify space.
Almost the same as writeJson5, except that if the directory does not exist, it's created.
Required
Type: String
Path of file to write. (If it ends with .gz
it will be compressed using gzip)
Required
Type: Object
Object to write.
Type: Function
JSON5.stringify replacer.
Type: String
or Number
JSON5.stringify replacer.
Almost the same as writeXml, except that if the directory does not exist, it's created.
Required
Type: String
Path of file to write. (If it ends with .gz
it will be compressed using gzip)
Required
Type: Object
Object to write.
Type: Object
xml2js.Builder().buildObject options.
Almost the same as writeYaml, except that if the directory does not exist, it's created.
Required
Type: String
Path of file to write. (If it ends with .gz
it will be compressed using gzip)
Required
Type: Object
Object to write.
Maps fse.pathExists
Reads and decompresses file using gzip.
Promise
returns an String
Required
Type: String
Path of file to read.
Maps fs.promises.readdir
Maps fs.promises.readFile
Reads a JSON file and then parses it into an object.
Promise
returns an Object
Required
Type: String
Path of file to read. (If it ends with .gz
it will be decompressed using gzip)
Type: Function
JSON.parse reviver.
Reads a JSON5 file and then parses it into an object.
Promise
returns an Object
Required
Type: String
Path of file to read. (If it ends with .gz
it will be decompressed using gzip)
Type: Function
JSON5.parse reviver.
Maps fs.promises.readlink
Reads a XML file and then parses it into an object.
Promise
returns an Object
Required
Type: String
Path of file to read. (If it ends with .gz
it will be decompressed using gzip)
Type: Object
xml2js.parseString options.
Reads a YAML file and then parses it into an object.
Promise
returns an Object
Required
Type: String
Path of file to read. (If it ends with .gz
it will be decompressed using gzip)
Maps fs.promises.realpath
Maps fse.remove
Uses delete-empty to recursively delete all empty folders in a directory and child directories
Promise
returns an Array
of deleted directories
Required
Type: String
Path of root directory to scan
Uses rimraf to delete files and directories via a globbing pattern
Required
Type: String
Globbing pattern
Maps fs.promises.rename
Maps fs.promises.rmdir
Uses klaw to scan directory for files or directories.
Return Array
of files / directories
Required
Type: String
Path of directory to scan.
Required
Type: String
Scan for file
or dir
Type: Boolean
Scan in subdirectories
Default: false
Type: String
Return full absolute path instead of relative path from scanned directory
Default: false
Type: String
Filter results with minimatch pattern
Default: '**'
Type: Boolean
Keep junk files (also filters out .gitkeep
)
Default: false
Maps fs.promises.stat
Maps fs.promises.symlink
Maps fs.promises.truncate
Maps fs.promises.unlink
Maps fs.promises.utimes
Compresses and writes content to file using gzip.
Required
Type: String
Path of file to write.
Required
Type: String
Content to write.
Writes an object to a JSON file.
Required
Type: String
Path of file to write. (If it ends with .gz
it will be compressed using gzip)
Required
Type: Object
Object to write.
Type: Function
JSON.stringify replacer.
Type: String
or Number
JSON.stringify space.
Writes an object to a JSON5 file.
Required
Type: String
Path of file to write. (If it ends with .gz
it will be compressed using gzip)
Required
Type: Object
Object to write.
Type: Function
JSON5.stringify replacer.
Type: String
or Number
JSON5.stringify replacer.
Writes an object to a XML file.
Required
Type: String
Path of file to write. (If it ends with .gz
it will be compressed using gzip)
Required
Type: Object
Object to write.
Type: Object
xml2js.Builder().buildObject options.
Writes an object to a YAML file.
Required
Type: String
Path of file to write. (If it ends with .gz
it will be compressed using gzip)
Required
Type: Object
Object to write.
fs
is graceful-fs
fse
is fs-extra
Maps fs.accessSync
Maps fs.appendFileSync
Maps fs.chmodSync
Maps fs.chownSync
Maps fs.closeSync
Compresses file using gzip
Return String
destination
Required
Type: String
Path of file to compress.
Type: String
Default: Same as source with a .gz
added at the end
Path of file when compressed.
Maps fse.copySync
Maps fs.copyFileSync
Decompresses file using gzip
Return String
destination
Required
Type: String
Path of file to decompress.
Type: String
Default: Same as source with the .gz
removed at the end
Path of file when decompressed.
Maps fse.emptyDirSync
Maps fse.ensureDirSync
Maps fse.ensureFileSync
Maps fse.ensureLinkSync
Maps fs.existsSync
Almost the same as fss.exists
, except that it also validates the case-sensitivity of the path.
Maps fs.fchmodSync
Maps fs.fchownSync
Maps fs.fdatasyncSync
Maps fs.fstatSync
Maps fs.fsyncSync
Maps fs.ftruncateSync
Maps fs.futimesSync
Maps fs.lchmodSync
Maps fs.lchownSync
Maps fs.linkSync
Maps fs.lstatSync
Maps fs.mkdirSync
Maps fse.mkdirpSync
Maps fse.mkdirsSync
Maps fs.mkdtempSync
Maps fse.moveSync
Maps fs.openSync
Almost the same as writeCompressed, except that if the directory does not exist, it's created.
Required
Type: String
Path of file to write.
Required
Type: String
Content to write.
Maps fse.outputFileSync
Almost the same as writeJson, except that if the directory does not exist, it's created.
Required
Type: String
Path of file to write. (If it ends with .gz
it will be compressed using gzip)
Required
Type: Object
Object to write.
Type: Function
JSON.stringify replacer.
Type: String
or Number
JSON.stringify space.
Almost the same as writeJson5, except that if the directory does not exist, it's created.
Required
Type: String
Path of file to write. (If it ends with .gz
it will be compressed using gzip)
Required
Type: Object
Object to write.
Type: Function
JSON5.stringify replacer.
Type: String
or Number
JSON5.stringify space.
Almost the same as writeXml, except that if the directory does not exist, it's created.
Required
Type: String
Path of file to write. (If it ends with .gz
it will be compressed using gzip)
Required
Type: Object
Object to write.
Type: Object
xml2js.Builder().buildObject options.
Almost the same as writeYaml, except that if the directory does not exist, it's created.
Required
Type: String
Path of file to write. (If it ends with .gz
it will be compressed using gzip)
Required
Type: Object
Object to write.
Maps fse.pathExistsSync
Maps fs.readSync
Reads and decompresses file using gzip.
Return String
Required
Type: String
Path of file to read.
Maps fs.readdirSync
Maps fs.readFileSync
Reads a JSON file and then parses it into an object.
Return Object
Required
Type: String
Path of file to read. (If it ends with .gz
it will be decompressed using gzip)
Type: Function
JSON.parse reviver.
Reads a JSON5 file and then parses it into an object.
Return Object
Required
Type: String
Path of file to read. (If it ends with .gz
it will be decompressed using gzip)
Type: Function
JSON5.parse reviver.
Maps fs.readlinkSync
Reads a XML file and then parses it into an object.
Return Object
Required
Type: String
Path of file to read. (If it ends with .gz
it will be decompressed using gzip)
Type: Object
xml2jsParser.parseStringSync options.
Reads a YAML file and then parses it into an object.
Return Object
Required
Type: String
Path of file to read. (If it ends with .gz
it will be decompressed using gzip)
Maps fs.realpathSync
Maps fse.removeSync
Uses delete-empty to recursively delete all empty folders in a directory and child directories
Return Array
of deleted directories
Required
Type: String
Path of root directory to scan
Uses rimraf to delete files and directories via a globbing pattern
Required
Type: String
Globbing pattern
Maps fs.renameSync
Maps fs.rmdirSync
Uses klaw-sync to scan directory for files or directories.
Return Array
of files / directories
Required
Type: String
Path of directory to scan.
Required
Type: String
Scan for file
or dir
Type: Boolean
Scan in subdirectories
Default: false
Type: String
Return full absolute path instead of relative path from scanned directory
Default: false
Type: String
Filter results with minimatch pattern
Default: '**'
Type: Boolean
Keep junk files (also filters out .gitkeep
)
Default: false
Maps fs.statSync
Maps fs.symlinkSync
Maps fs.truncateSync
Maps fs.unlinkSync
Maps fs.utimesSync
Maps fs.writeSync
Compresses and writes content to file using gzip.
Required
Type: String
Path of file to write.
Required
Type: String
Content to write.
Maps fs.writeFileSync
Writes an object to a JSON file.
Required
Type: String
Path of file to write. (If it ends with .gz
it will be compressed using gzip)
Required
Type: Object
Object to write.
Type: Function
JSON.stringify replacer.
Type: String
or Number
JSON.stringify space.
Writes an object to a JSON5 file.
Required
Type: String
Path of file to write. (If it ends with .gz
it will be compressed using gzip)
Required
Type: Object
Object to write.
Type: Function
JSON5.stringify replacer.
Type: String
or Number
JSON5.stringify space.
Writes an object to a XML file.
Required
Type: String
Path of file to write. (If it ends with .gz
it will be compressed using gzip)
Required
Type: Object
Object to write.
Type: Object
xml2js.Builder().buildObject options.
Writes an object to a YAML file.
Required
Type: String
Path of file to write. (If it ends with .gz
it will be compressed using gzip)
Required
Type: Object
Object to write.