Socket
Socket
Sign inDemoInstall

get-all-files

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

get-all-files

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


Version published
Weekly downloads
8K
increased by18.02%
Maintainers
1
Weekly downloads
 
Created
Source

Get All Files

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

JavaScript Style Guide

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

Soon!

Keywords

FAQs

Package last updated on 12 Jun 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc