Skip to content

Instantly share code, notes, and snippets.

@mohsen1

mohsen1/fs.js

Created May 29, 2013
Embed
What would you like to do?
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