Created
November 27, 2015 22:27
-
-
Save evaldosantos/529e2581abb429ba8eab to your computer and use it in GitHub Desktop.
This file contains hidden or 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
//console.log('HELLO WORLD') | |
//console.log(process.argv.slice(2).reduce(function(sum, el) { return sum+parseInt(el, 10);}, 0)) | |
//var fs = require('fs'); | |
//var file = fs.readFileSync(process.argv[2]); | |
//console.log(file.toString().split('\n').length-1); | |
//var fs = require('fs'); | |
//fs.readFile(process.argv[2], function(err, data) { | |
// if(!err) { | |
// console.log(data.toString().split('\n').length-1); | |
// } | |
//}); | |
var fs = require('fs'); | |
var path = require('path'); | |
fs.readdir(process.argv[2], function(err, list) { | |
if(!err) { | |
list.forEach(function(el, arr, idx) { | |
if(path.extname(el) === '.' + process.argv[3]) { | |
console.log(el); | |
} | |
}); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment