Skip to content

Instantly share code, notes, and snippets.

@phihag
Created March 20, 2012 12:35
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 phihag/2134731 to your computer and use it in GitHub Desktop.
Save phihag/2134731 to your computer and use it in GitHub Desktop.
Empty file written - demo code
var fs = require('fs');
var file_tree = ['test1.txt', 'test2.txt'];
var data = ['d1', 'd2'];
for(i in file_tree) {
fp = fs.createWriteStream(file_tree[i]);
for(i in data) {
fp.write(data[i]+'\n', function (err) { if(err) throw err;});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment