2.1.0 • Published 5 years ago

pyfiles v2.1.0

Weekly downloads
1
License
MIT
Repository
github
Last release
5 years ago

pyfiles

get file or folder locations using 'fs', results by array

Getting Started

Installing

Installing pyfiles.

npm install pyfiles

How to use

CodeDescription
adirectory.
brecursive boolean (true or false), false by default
cfilter name, type N by default
dfilter items. empty array by default
eitem result from r
fitem filter from d
gdirectory name of e
robject pyfiles results
r.allobject all file and directory from r
r.filesget all file from r
r.dirsget all directory from r

Using Require

consr pyfiles = require('pyfiles');
const a = 'directory_address';
const b = true; // recursive
const c = 'include-extension' // filter type;
const d = ['php','js'] // f;
const r = new pyfiles(a,b,c,d);

const all = r.all; // all results
const files = r.files; // all file results
const dirs = r.dirs; // all dir results

console.log("total results all: " + all.length);
console.log("total results files: " + files.length);
console.log("total results dirs: " + dirs.length);

console.log("results dirs:\n");
console.log(dirs);

console.log("results files:\n");
console.log(files);

console.log("results all:\n");
console.log(all);

Filters

pyfiles have include,exclude and N filter type name for filtering item result. N default for deactive pyfile filter.

Filter Include

NameDescription
include-equalsfilter e === f
include-dir-equalsfilter e === g + f
include-indexoffilter using indexOf e.indexOf(f) !== -1
include-dir-indexoffilter using indexOf e.indexOf( g + f ) !== -1
include-indexof-firstfilter using indexOf from e first index
include-dir-indexof-firstfilter using indexOf from e first index use g + f
include-regexfilter using match e.match( f )
include-extensionfilter using path.extname path.extname(e) === f

Filter Exclude

NameDescription
exclude-equalsfilter e === f
exclude-dir-equalsfilter e === g + f
exclude-indexoffilter using indexOf e.indexOf(f) !== -1
exclude-dir-indexoffilter using indexOf e.indexOf( g + f ) !== -1
exclude-indexof-firstfilter using indexOf from e first index
exclude-dir-indexof-firstfilter using indexOf from g + e first index use g + f
exclude-regexfilter using match e.match( f )
exclude-extensionfilter using path.extname path.extname(e) === f

Filter N

NameDescription
Ndefault

Using Cli

for now cli not support for filtering

npm run pyfiles arg1 arg2 arg3
  1. arg1 = dirname.
  2. arg2 = all,files,dirs by default all.
  3. arg3 = reqursive boolean (true or false), false by default

License

MIT

2.1.0

5 years ago

2.0.0

5 years ago

1.0.6

6 years ago

1.0.5

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago