node package manager
We need your input. Help make JavaScript better: Take the 2017 JavaScript Ecosystem survey ยป



You probably want to use node-glob:

If not, here's a smaller, more limited directory search plugin for you.

Recursively search a directory and return a list of matching files. Currently searches only by matching file extension.


var dirSearch = require('directory-search');

// Search 'public' directory for '.css' files.
dirSearch('public', '.css', function(err, results) {
  if (err) throw err;

Will result in an array that looks something like this:

[ 'public/styles/app.css',
  'public/styles/home/login.css' ]