Giter Site home page Giter Site logo

fossabot / get-all-files Goto Github PK

View Code? Open in Web Editor NEW

This project forked from tomeraberbach/get-all-files

0.0 1.0 0.0 30 KB

A fast parallel stack-based readdir-recursively module with micromatch support.

Home Page: https://www.npmjs.com/package/get-all-files

License: MIT License

JavaScript 100.00%

get-all-files's Introduction

Get All Files

A fast parallel stack-based readdir-recursively module with micromatch support.

JavaScript Style Guide FOSSA Status

JavaScript Style Guide

getAllFiles

If filename is a file, creates an array containing the file path. Otherwise creates an array containing the file paths of all files recursively in the given directory.

The array is filtered by the given glob pattern(s) and/or predicate(s) and returned as a promise.

Parameters:

  • filename {string}: A path to a file or directory.
  • arr {string|function|(string|function)[]} (optional): A string glob pattern, a function taking a file path and returning a boolean, or an array of containing any number of of the former two options.
  • opt {Object} (optional): An options object for the micromatch module.

Examples:

const getAllFiles = require('get-all-files')

// All files
getAllFiles('path/to/dir/or/file').then(files => console.log(files))

// All javascript files
getAllFiles('path/to/dir/or/file', '*.js', {matchBase: true}).then(files => console.log(files))

// All files where their path is all lowercase
getAllFiles(
  'path/to/a/dir/or/file',
  filename => filename.toLowerCase() === filename
).then(files => console.log(files))

// A combination of options
getAllFiles(
  'path/to/dir/or/file',
  ['*.js', 'foo*', filename => filename.toLowerCase() === filename],
  {matchBase: true}
).then(files => console.log(files))

Benchmarks

To see the performance of this module in comparison to other similar modules clone the repository and run npm start in the benchmark directory.

Sample output (lower is less time):

Results from reading node_modules:
  get-all-files: 0.011025358324145534
  recur-readdir: 0.013531799729364006
  recursive-readdir: 0.01763668430335097
  recursive-files: 0.023923444976076555
  all-files-in-tree: 0.033444816053511704
  fs-readdir-recursive: 0.07518796992481203

License

FOSSA Status

get-all-files's People

Contributors

fossabot avatar tomeraberbach avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.