Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/eknkc/walkfs
Recursively walk over filesystem directories.
https://github.com/eknkc/walkfs
Last synced: 9 days ago
JSON representation
Recursively walk over filesystem directories.
- Host: GitHub
- URL: https://github.com/eknkc/walkfs
- Owner: eknkc
- Created: 2013-10-30T00:52:24.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2014-07-11T16:33:51.000Z (over 10 years ago)
- Last Synced: 2024-12-17T01:34:17.427Z (17 days ago)
- Language: JavaScript
- Size: 129 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# walkfs
Recursively walk over filesystem directories.## install
```
npm install walkfs
```## usage
### iterator mode
#### walkfs(directory, iterator, [oncomplete])```
var walkfs = require('walkfs');walkfs('/tmp', function(entry, next) {
console.log(entry);
// {
// type: 'file|directory|link',
// path: ,
// stat:
// }
next();
}, function(err) {
console.log('completed');
})
```### event emitter mode
#### walkfs(directory).on('file|link|directory|path|error|end', handler)```
var walkfs = require('walkfs');
walkfs('/tmp')
.on('path', function(entry) {
// emitted for all directories, links and files with the entry object specified above.
})
.on('file', function(entry) {
// emitted for all files with the entry object specified above.
})
.on('link', function(entry) {
// emitted for all links with the entry object specified above.
})
.on('directory', function(entry) {
// emitted for all directories with the entry object specified above.
})
.on('error', function(err) {
console.log('error: ' + err.message);
})
.on('end', function() {
console.log('completed');
})
```## license
MIT