Below is the exercise 5 of nodeschool learnyounode module
Create a program that prints a list of files in a given directory, filtered by he extension of the files. You w
Here's the official solution:
var fs = require('fs') var path = require('path') fs.readdir(process.argv[2], function (err, list) { list.forEach(function (file) { if (path.extname(file) === '.' + process.argv[3]) console.log(file) }) })