Security News
Input Validation Vulnerabilities Dominate MITRE's 2024 CWE Top 25 List
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
fse-promise
Advanced tools
Promisified version of Node fs and fs-extra that preserves callbacks.
npm install fse-promise
Drop-in replacement for Node fs and fs-extra module.
All Node fs
and fs-extra
asynchronous methods are wrapped so that
they return a promise if callback is not provided.
If callback is defined then the method works as defined in fs
and
fs-extra
.
Check index.js
for list of supported methods.
If you notice any missing methods in that list, add it and create PR to get it added.
Example usage:
const fs = require('fse-promise');
// using callbacks
fs.readFile(filepath, (err, data) => {
if (err) return console.error(err);
console.log(data);
fs.outputFile(filepath, (err, data => {
if (err) return console.error(err);
console.log('saved');
}));
});
// using promises
fs.readFile(filepath)
.then((data) => {
console.log(data);
return fs.outputFile(filepath);
})
.then(() => {
console.log('saved');
})
.catch((err) => {
console.error(err);
});
FAQs
Promisefied version of fs-extra and fs that preserves callbacks
The npm package fse-promise receives a total of 7 weekly downloads. As such, fse-promise popularity was classified as not popular.
We found that fse-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
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.
Research
Security News
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.