README
enfs-promise
Module that add methods and patches to node fs module with promises
enfs stands for [E]asy [N]ode [fs]
Description
This module will add many methods to node fs module. This is just the main module that will join many modules of the family of enfs, making it easier to use many of the methods present in each module.
Modules
- enfspatch-promise
- enfsaddins-promise
- enfslist-promise
- enfsfind-promise
- enfsmkdirp-promise
- enfsensure-promise
- enfscopy-promise
- enfsmove-promise
- enfscompare-promise
Methods Added
- emptyDir
- emptyDirSync
Usage
enfs
is a drop-in replacement for native fs
module, you just need to include
it instead of the native module.
Use this
const enfs = require("enfs-promise");
instead of
const fs = require("fs"); //You don't need to do this anymore
and all the methods from native fs module are available
Errors
All the methods follows the node culture.
- Async: Every async method returns an Error in the first callback parameter
- Sync: Every sync method throws an Error.
Additional Methods
emptyDir
- emptyDir(path, callback)
Remove all items from the directory this method use rimraf, then you can pass wildcards to the path like you do in rimraf
enfs.emptyDir("/path/to/empty", function(err){
if(!err) {
console.log("Directory is empty");
}
});
emptyDirSync
- emptyDirSync(path)
Remove all items from the directory this method use rimraf.sync, then you can pass wildcards to the path like you do in rimraf
enfs.emptyDirSync("/path/to/empty");
console.log("Directory is empty");
emptyDirP
- emptyDirP(path)
Remove all items from the directory this method use rimraf, then you can pass wildcards to the path like you do in rimraf
enfs.emptyDir("/path/to/empty").then(function(){
console.log("Directory is empty");
});
remove
- remove(path, callback)
Remove an item from the file system this method use rimraf, then you can pass wildcards to the path like you do in rimraf
enfs.remove("/path/to/empty", function(err){
if(!err) {
console.log("Path was deleted.");
}
});
removeSync
- removeSync(path)
Remove an item from the file system this method use rimraf.sync, then you can pass wildcards to the path like you do in rimraf
enfs.removeSync("/path/to/empty");
console.log("Item deleted.");
removeP
- removeP(path)
Remove an item from the file system this method use rimraf, then you can pass wildcards to the path like you do in rimraf
enfs.remove("/path/to/empty").then(function(){
console.log("Item deleted.");
});
Additional methods from sub-modules
- enfspatch
- exists -
enfs.exists
- existsSync -
enfs.existsSync
- existAccess -
enfs.existAccess
- existAccessSync -
enfs.existAccessSync
- existStat -
enfs.existStat
- existLStat -
enfs.existLStat
- existFStat -
enfs.existFStat
- existStatSync -
enfs.existStatSync
- existLStatSync -
enfs.existLStatSync
- existFStatSync -
enfs.existFStatSync
- exists -
- enfslist
- enfsfind
- enfsmkdirp
- mkdirp -
enfs.mkdirp
- mkdirpSync -
enfs.mkdirpSync
- mkdirp -
- enfsensure
- ensureFile -
enfs.ensureFile
- ensureFileSync -
enfs.ensureFileSync
- ensureDir -
enfs.ensureDir
- ensureDirSync -
enfs.ensureDirSync
- ensureLink -
enfs.ensureLink
- ensureLinkSync -
enfs.ensureLinkSync
- ensureSymlink -
enfs.ensureSymlink
- ensureSymlinkSync -
enfs.ensureSymlinkSync
- ensureFile -
- enfscopy
- enfsmove
- enfscompare
- compareFiles -
enfs.compareFiles
- compareFilesSync -
enfs.compareFilesSync
- compareFilesHash -
enfs.compareFilesHash
- compareFilesHashSync -
enfs.compareFilesHashSync
- compareDir -
enfs.compareDir
- compareDirSync -
enfs.compareDirSync
- compareDirHash -
enfs.compareDirHash
- compareDirHashSync -
enfs.compareDirHashSync
- compareFiles -
- Promises
- enfspatch-promise
- existsP -
enfs.existsP
- existAccessP -
enfs.existAccessP
- existStatP -
enfs.existStatP
- existLStatP -
enfs.existLStatP
- existFStatP -
enfs.existFStatP
- existsP -
- enfslist-promise
- listP -
enfs.listP
- listP -
- enfsfind-promise
- findP -
enfs.findP
- findP -
- enfsmkdirp-promise
- mkdirpP -
enfs.mkdirpP
- mkdirpP -
- enfsensure-promise
- ensureFileP -
enfs.ensureFileP
- ensureDirP -
enfs.ensureDirP
- ensureLinkP -
enfs.ensureLinkP
- ensureSymlinkP -
enfs.ensureSymlinkP
- ensureFileP -
- enfscopy-promise
- copyP -
enfs.copyP
- copyP -
- enfsmove-promise
- moveP -
enfs.moveP
- moveP -
- enfscompare-promise
- compareFilesP -
enfs.compareFilesP
- compareFilesHashP -
enfs.compareFilesHashP
- compareDirP -
enfs.compareDirP
- compareDirHashP -
enfs.compareDirHashP
- compareFilesP -
- enfspatch-promise
License
Creative Commons Attribution 4.0 International License
Copyright (c) 2016 Joao Parreira joaofrparreira@gmail.com GitHub
This work is licensed under the Creative Commons Attribution 4.0 International License. To view a copy of this license, visit CC-BY-4.0.