Created
September 26, 2022 18:09
-
-
Save nairihar/424357dc31bbad743c5113aa692c64c4 to your computer and use it in GitHub Desktop.
Three ways to work with File System in Node.js | Promises
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const fs = require('fs/promises'); | |
fs.readFile('LICENSE.md') | |
.then(data => { | |
// ... | |
}) | |
.catch(err => { | |
// ... | |
}); | |
fs.writeFile('README.md', 'This is awesome!') | |
.catch(err => { | |
// ... | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment