JSPM

async-dir-walk

1.0.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 2
  • Score
    100M100P100Q18016F
  • License MIT

Walks through a directory and all subdirectories (including nested) at the same time and returns a promise resolving to an array of file paths.

Package Exports

  • async-dir-walk
  • async-dir-walk/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (async-dir-walk) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

async-dir-walk

Walks through a directory and all subdirectories (including nested) asynchronously and returns a Promise that resolves to an array of file paths. With no dependencies.

Usage

Installing

npm i async-dir-walk -P

Importing

const walk = require("async-dir-walk");

Usage Example

Filestructure:

./
├── test/
│   ├── file1.js
│   ├── file2.js
│   ├── file3.js
│   └── folder1
│       ├── folder1File1.js
│       ├── folder1File3.js
│       ├── folder1File2.js
│       └── folder 2
│           ├── folder2File1.js
│           └── folder 3
│               └── folder 4
│                   └── folder 5
│                       └── folder 6
│                           └── folder6File1.js
├── index.js
└── package.json

index.js:

const walk = require("dirwalk");

walk("./test")
  .then(results => console.log("`Test` directory contents: %s", results.join(", "))
  .catch(error => console.error("Error walking directory `Test`: ", error);

API

walk(dir) Walks the provided directory and traverses through all subdirectories (including those nested), collecting file names in a parallel fashion. Returns a Promise that resolves to an array of file paths.