Node.js module that recursively traversing files/directories
JavaScript
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
test
.travis.yml
README.md
file-walker.js
package.json

README.md

A Simple file/directory traversal module

Build Status

Installation

npm install file-walker

Callback arguments

  • files - an array of files/directories in current directory e.g. ['dummy', 'test.js']
  • dir - directory name e.g. './test'
  • level - Current directory level starting from 0

Example usage

Assume we have the following directory structure

./test/
  +- a.js
  +- b/
     +- c.js
     +- d.js
var walk = require('file-walker');

walk('./directory', function(dir, files, level) {
    // 1st iteration, level = 0, dir = './test', files = ['a.js', 'b']
    // 2nd iteration, level = 1, dir = './test/b', files = ['c.js', 'd.js']
	// your logic
});