var fs = require('fs'); fs.mkdir('./hello',0777,function(err){ if (err) throw err; fs.writeFile('./hello/world.txt', 'Hello!', function(err){ if (err) throw err; console.log('File created with contents: '); fs.readFile('./hello/world.txt', 'UTF-8', function(err, data){ if (err) throw err; console.log(data); }); }); });