Last active
June 19, 2017 19:11
-
-
Save wesdeveloper/7e6d75204f35ce55abeb1c308f8db176 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') | |
let texto = 'Coffee is life!' | |
const escreve = (file, texto) => new Promise((resolve, reject) => fs.writeFile(file, texto, (err) => err ? reject(err) : resolve())) | |
escreve('teste.txt', texto) | |
.then(() => console.log('Deu certo..')) | |
.catch(() => console.log('Deu ruim... TRATAR')) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment