Created
August 22, 2014 13:50
-
-
Save Pompeu/6b266ce8543be88f1ae8 to your computer and use it in GitHub Desktop.
chamano Funcion JS
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
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