Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
enfsaddins-promise
Advanced tools
Additional methods for node fs module with promises
Additional methods for node fs module with promises
enfs stands for [E]asy [N]ode [fs]
This module is intended to work as a sub-module of enfspatch-promise
This module will add promises to enfsaddins for async methods
All async
methods will have their name + 'P' (ex: exists => existsP)
enfsaddins-promise
Valid usage but not the better:
const fs = require("fs");
const enfs = require("enfsaddins-promise")(fs);
It's better to use
const enfs = require("enfspatch-promise");
this will use enfspatch-promise module that implements this module and allows access to all it's methods
All the methods follows the node culture.
Change the natural behaviour of fs.exists to the node culture, it will return an error in the first callback parameter. As exists is deprecated if it cease to exist then exists will use (#existStat) instead
enfs.existsP("/etc/passwd").then(function(itemExists){
console.log(itemExists ? 'it\'s there' : 'no passwd!');
});
check: fs.exists
Will use fs.access to check if the item exists in the file system and if the process as access to the item.
enfs.existAccessP("/etc/passwd").then(function(itemExists){
console.log(itemExists ? "it\'s there and have access" : "don\'t exist or don\'t have access");
});
check: fs.access
Will use fs.stat to check if the item exists in the file system.
enfs.existStatP("/etc/passwd").then(function(itemExists){
console.log(itemExists ? "it\'s there" : "don\'t exist");
});
check: fs.stat
enfs.existLStatP("/etc/passwd").then(function(itemExists){
console.log(itemExists ? "it\'s there" : "don\'t exist");
});
check: fs.lstat
Will use fs.fstat to check if the item exists in the file system.
enfs.existFStatP(fs.openSync("/etc/passwd","r")).then(function(itemExists){
console.log(itemExists ? "it\'s there" : "don\'t exist");
});
check: fs.fstat
Will use fs.stat or fs.lstat or fs.fstat to check if the item exists in the file system, and if it's a directory. This method is just a shortcut to check if an item exists in the file system and it's type
enfs.existStatIsDirectoryP("/etc").then(function(isDirectory){
console.log(isDirectory ? "it's a directory" : "don\'t exist or it's not a directory.");
});
check: fs.stat fs.lstat fs.fstat
Will use fs.stat or fs.lstat or fs.fstat to check if the item exists in the file system, and if it's a file. This method is just a shortcut to check if an item exists in the file system and it's type
enfs.existStatIsFileP("/etc/passwd").then(function(isFile){
console.log(isFile ? "it's a file" : "don\'t exist or it's not a file.");
});
check: fs.stat fs.lstat fs.fstat
Will use fs.lstat to check if the item exists in the file system, and if it's a symbolic link. This method is just a shortcut to check if an item exists in the file system and it's type
enfs.existIsSymlinkP("/etc/symlink").then(function(isSymlink){
console.log(isSymlink ? "it's a symlink" : "don\'t exist or it's not a symlink.");
});
check: fs.lstat
Creative Commons Attribution 4.0 International License
Copyright (c) 2017 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 CCA4.
FAQs
Additional methods for node fs module with promises
The npm package enfsaddins-promise receives a total of 0 weekly downloads. As such, enfsaddins-promise popularity was classified as not popular.
We found that enfsaddins-promise demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.