find file with wild card matching
Problem
In node.js, can I list files with wild card matching like
fs.readdirSync('C:/tmp/*.csv')?
I did not find the information on wild card matching from the fs documention.
Problem Courtesy of: ahala
Solution
This is not covered by Node core. You can check out this module for what you are after. npmjs.org is also a great resource for finding various modules.
Usage
var glob = require("glob")
// options is optional
glob("**/*.js", options, function (er, files) {
// files is an array of filenames.
// If the `nonull` option is set, and nothing
// was found, then files is ["**/*.js"]
// er is an error object or null.
})
Solution courtesy of: Morgan ARR Allen
Discussion
View additional discussion.