Created
July 12, 2015 12:40
-
-
Save zeffii/654222568be57d326656 to your computer and use it in GitHub Desktop.
node js filereader and splitter
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// usage node local_reader.js /some/directory | |
fp = process.argv[2] | |
fs = require('fs') | |
fs.readFile(fp + '/urllist.hash', 'utf8', function (err,data) { | |
if (err) { | |
return console.log(err); | |
} | |
make_object(data) | |
}); | |
function make_object(data){ | |
files = data.split("\n"); | |
files.forEach(logArrayElements); | |
} | |
function logArrayElements(element, index, array) { | |
if (element) console.log(fp + "/" + element); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment