Created
May 29, 2013 14:51
-
-
Save mohsen1/5670881 to your computer and use it in GitHub Desktop.
Wrong node
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 fs = require('fs'); | |
var random = (~~(Math.random() * 1e9)).toString(2); | |
fs.writeFile('./random.txt', random, function(err){ | |
if(err) console.error(err); | |
else console.log('file has been written'); | |
}); | |
fs.readFile('./random.txt','utf8', function(err, file){ | |
if(err) console.error(err); | |
else | |
console.log(file); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment