Created
August 19, 2019 06:30
-
-
Save MelodicCrypter/1c67e3fe9c6d9e5c71bc4680b7124494 to your computer and use it in GitHub Desktop.
A NodeJS sample of using Util's promisify to write a file.
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'); | |
const { promisify } = require('util'); | |
const writeFile = promisify(fs.writeFile); | |
writeFile('sample.txt', 'this is a sample phrase') | |
.then(() => console.log('done!')) | |
.catch(e => console.log(e)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment