Skip to content

Instantly share code, notes, and snippets.

@zolotyh
Created December 16, 2021 10:47
Show Gist options
  • Save zolotyh/1aa68d7fdd629cd91e8cefe3ef7b41d3 to your computer and use it in GitHub Desktop.
Save zolotyh/1aa68d7fdd629cd91e8cefe3ef7b41d3 to your computer and use it in GitHub Desktop.
import fs from 'fs/promises'
function write(){
return fs.mkdir('./tmp').then(function(){
fs.writeFile('./tmp/foo.txt', 'Hello World');
}).catch((err) => {
/// handle error
console.log(err);
});
}
write();
// What does this code do? Is there anything that could be improved?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment