Skip to content

Instantly share code, notes, and snippets.

@Pompeu
Created August 22, 2014 13:50
Show Gist options
  • Save Pompeu/6b266ce8543be88f1ae8 to your computer and use it in GitHub Desktop.
Save Pompeu/6b266ce8543be88f1ae8 to your computer and use it in GitHub Desktop.
chamano Funcion JS
var arquivo = require ('fs');
var path = './novo.txt';
arquivo.readFile('./clubes.txt',function(err,data){
if(err) throw err;
console.log(data.toString());
});
arquivo.exists(path,function(resultado){
if(!resultado){
arquivo.writeFile(path,'Criando Arquivo NodeJS',function(err){
if(err)throw err;
console.log("Arquivo criado com sucesso !!!!");
});
}else{
console.log('Arquivo ja existe !!!!');
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment