source: frontend/node_modules/walker/readme.md

Last change on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 11 days ago

Fix frontend appearance

  • Property mode set to 100644
File size: 1.7 KB
Line 
1walker [![Build Status](https://secure.travis-ci.org/daaku/nodejs-walker.png)](http://travis-ci.org/daaku/nodejs-walker)
2======
3
4A nodejs directory walker. Broadcasts events for various file types as well as
5a generic "entry" event for all types and provides the ability to prune
6directory trees. This shows the entire API; everything is optional:
7
8```javascript
9Walker('/etc/')
10 .filterDir(function(dir, stat) {
11 if (dir === '/etc/pam.d') {
12 console.warn('Skipping /etc/pam.d and children')
13 return false
14 }
15 return true
16 })
17 .on('entry', function(entry, stat) {
18 console.log('Got entry: ' + entry)
19 })
20 .on('dir', function(dir, stat) {
21 console.log('Got directory: ' + dir)
22 })
23 .on('file', function(file, stat) {
24 console.log('Got file: ' + file)
25 })
26 .on('symlink', function(symlink, stat) {
27 console.log('Got symlink: ' + symlink)
28 })
29 .on('blockDevice', function(blockDevice, stat) {
30 console.log('Got blockDevice: ' + blockDevice)
31 })
32 .on('fifo', function(fifo, stat) {
33 console.log('Got fifo: ' + fifo)
34 })
35 .on('socket', function(socket, stat) {
36 console.log('Got socket: ' + socket)
37 })
38 .on('characterDevice', function(characterDevice, stat) {
39 console.log('Got characterDevice: ' + characterDevice)
40 })
41 .on('error', function(er, entry, stat) {
42 console.log('Got error ' + er + ' on entry ' + entry)
43 })
44 .on('end', function() {
45 console.log('All files traversed.')
46 })
47```
48
49You specify a root directory to walk and optionally specify a function to prune
50sub-directory trees via the `filterDir` function. The Walker exposes a number
51of events, broadcasting various file type events a generic error event and
52finally the event to signal the end of the process.
Note: See TracBrowser for help on using the repository browser.