Created
September 26, 2022 18:16
-
-
Save nairihar/d26861299d61f5e594c28e21084d708c to your computer and use it in GitHub Desktop.
Three ways to work with File System in Node.js | Async / Await
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'); | |
(async () => { | |
const data = await fs.readFile('LICENSE.md'); | |
try { | |
await 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