Skip to content

Instantly share code, notes, and snippets.

@mohsen1
Created May 29, 2013 14:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mohsen1/5670881 to your computer and use it in GitHub Desktop.
Save mohsen1/5670881 to your computer and use it in GitHub Desktop.
Wrong node
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