Skip to content

Instantly share code, notes, and snippets.

@thihenos
Created September 18, 2018 20:07
Show Gist options
  • Select an option

  • Save thihenos/cb646b1c25ccbd12a83a20c19071869e to your computer and use it in GitHub Desktop.

Select an option

Save thihenos/cb646b1c25ccbd12a83a20c19071869e to your computer and use it in GitHub Desktop.
let fs = require('fs');
/* No exemplo abaixo, informamos o local que será criado o arquivo
toda a informação que esse arquivo conterá, e por ultimo temos nossa função callback */
fs.writeFile("./files/example.txt",'Um breve texto aqui!', function(err){
//Caro ocorra algum erro
if(err){
return console.log('erro')
}
//Caso não tenha erro, retornaremos a mensagem de sucesso
console.log('Arquivo Criado');
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment