Skip to content

AceMood/node-yaff

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Yet Another Files Finder in Node

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published