Created
February 15, 2020 18:26
-
-
Save boxabirds/38e6f56cdd1bdf4bbaad697b48873fa4 to your computer and use it in GitHub Desktop.
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 path = require('path'); | |
async function create_file_in_new_folder_with_promises() { | |
try { | |
await fsp.mkdir(path.join(__dirname, '/promise-test')); | |
await fsp.writeFile( | |
path.join(__dirname, '/promise-test', 'writeFile-promise-demo.txt'), | |
"Hello world from the land of promises" | |
); | |
} catch(err) { | |
console.log("Ugh sorry I failed even when using fancy promises. Error ${err}"); | |
} | |
} | |
create_file_in_new_folder_with_promises(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment