Yet Another Files Finder in Node. Provide a unique way to walk through specific directories and find all matched files.
class Finder(dirs, extensions, ignore, native);
Finder.prototype.find: Promise;
Finder.findInNative(dirs, extensions, ignore, resolve, reject): void;
Finder.findInNode(dirs, extensions, ignore, resolve, reject): void;
directories to be scanned. Defaults to '.'
file extensions to be matched. Defaults to '*'
ignore function that accept a filePath and decide whether ignore it or not
use shell or node logic
Currently node-yaff only used for programmatically.
find all files in current working directory:
const Finder = require('node-yaff');
const f = new Finder(['./'], /* '*' also make sense */);
f.find().then(files => {
// all files
})
find all js files in current working directory:
const Finder = require('node-yaff');
const f = new Finder(['./'], ['.js']);
f.find().then(files => {
// all js files
})
find all files do not have special character:
const Finder = require('node-yaff');
const f = new Finder(['./'], '*', p => /s$/.test(p));
f.find().then(files => {
// all files without s as a suffix character
})