Skip to content

Instantly share code, notes, and snippets.

@nickleefly
Created January 20, 2013 09:18
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 nickleefly/4577430 to your computer and use it in GitHub Desktop.
Save nickleefly/4577430 to your computer and use it in GitHub Desktop.
read from input, write to output create dir then remove it
var fs = require('fs');
var file = fs.createReadStream('./input.txt', {flags: 'r'} );
var out = fs.createWriteStream('./output.txt', {flags: 'w'});
file.pipe(out);
var fs = require('fs');
fs.mkdir('./newdir', 0666, function(err) {
if(err) throw err;
console.log('Created newdir');
fs.rmdir('./newdir', function(err) {
if(err) throw err;
console.log('Removed newdir');
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment