Recursively find and filter files and folders in a directory.
npm install --save finder-on-steroids
import finder from "../src";
const directory = process.argv[4] || ".";
finder(directory)
.files()
.depth(1)
.name("*.ts")
.find()
.then(
files => {
console.log("\n Found " + files.length + " TypeScript files:");
console.log(" - " + files.sort().join("\n - ") + "\n");
},
error => console.error(error)
);
Create a new finder object.
Restrict results to contain only files as identified by fs.Stat.isFile()
.
Restrict results to contain only directories identified by fs.Stat.isDirectory()
.
Restrict results to contain only paths up to a specific depth.
Restrict results to contain only files and directories with base names that match the specified pattern. Takes a glob string or a RegExp.
Restrict results to contain only files and directories with dir names that match paths that match the specified pattern. Takes a glob string or RegExp.
Restrict results to contain only files and directories of size within the specified range.
Restrict results to contain only files and directories according to a custom filter function.
Restrict results to contain only files and directories according to a custom filter function.
Start finding files.
The MIT License (MIT)
Copyright (c) 2014 James Newell