Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mcfedr/fswalk
The simplest possible directory walker
https://github.com/mcfedr/fswalk
Last synced: 7 days ago
JSON representation
The simplest possible directory walker
- Host: GitHub
- URL: https://github.com/mcfedr/fswalk
- Owner: mcfedr
- License: mit
- Created: 2013-11-23T21:20:39.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2016-04-26T12:40:44.000Z (over 8 years ago)
- Last Synced: 2024-10-16T06:33:53.854Z (2 months ago)
- Language: JavaScript
- Size: 8.79 KB
- Stars: 0
- Watchers: 3
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# fswalk
> The simplest possible directory walker
[![Build Status](https://img.shields.io/travis/mcfedr/fswalk.svg?style=flat-square)](https://travis-ci.org/mcfedr/fswalk)
[![npm version](https://img.shields.io/npm/v/fswalk.svg?style=flat-square)](https://npmjs.org/package/fswalk)## Installation
```bash
npm install fswalk
```## Example
```js
var walk = require('fswalk');walk(__dirname, function(path, stats) {
console.log(path, stats);
}, function(err) {
assert(!err);
});
```## API
#### `walk(dir, walkCb, finishCb, limit)`
##### Parameters
* `dir`: The directory to walk
* `walkCb`: `function(file, stats[, callback])` The function to be called with each file.* * `file`: Relative file path
* * `stats`: [fs.Stats](https://nodejs.org/docs/latest/api/fs.html#fs_class_fs_stats) object* * `callback`: If given, any errors will be propagated to `finishCb` and the walk will stop soon. `walkCb` is called in parallel for some files, so the walk will stop at the current folder. `finishCb` will not be called until all `walkCb` callbacks have been called.
* `finishCb`: `function(err)` Called when all files have been walked.
* `limit`: Max depth, `undefined` means no limit