https://github.com/rezigned/node-file-walker
Node.js module that recursively traversing files/directories
https://github.com/rezigned/node-file-walker
Last synced: about 1 year ago
JSON representation
Node.js module that recursively traversing files/directories
- Host: GitHub
- URL: https://github.com/rezigned/node-file-walker
- Owner: rezigned
- Created: 2013-07-25T14:34:56.000Z (almost 13 years ago)
- Default Branch: master
- Last Pushed: 2014-12-11T17:28:38.000Z (over 11 years ago)
- Last Synced: 2024-05-02T14:36:43.306Z (almost 2 years ago)
- Language: JavaScript
- Homepage:
- Size: 178 KB
- Stars: 4
- Watchers: 2
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## A Simple file/directory traversal module
[](https://travis-ci.org/rezigned/node-file-walker)
### 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
```
```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
});
```