node-yaff

0.3.1 • Public • Published

node-yaff

Yet Another Files Finder in Node. Provide a unique way to walk through specific directories and find all matched files.

Build Status Downloads Coverage Status Dependency MIT

API

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;

dirs:Array|String|undefined

directories to be scanned. Defaults to '.'

extensions:Array|String|undefined

file extensions to be matched. Defaults to '*'

ignore:Function|undefined

ignore function that accept a filePath and decide whether ignore it or not

native: boolean|undefined

use shell or node logic

Usage

Currently node-yaff only used for programmatically.

example one

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 
})

example two

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
})

example three

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
})

Readme

Keywords

Package Sidebar

Install

npm i node-yaff

Weekly Downloads

0

Version

0.3.1

License

MIT

Unpacked Size

15.3 kB

Total Files

14

Last publish

Collaborators

  • acemood