Skip to content

Commit 55b91b8

Browse files
committed
use github markdown syntax
1 parent 7dbe7df commit 55b91b8

File tree

1 file changed

+40
-38
lines changed

1 file changed

+40
-38
lines changed

readme.md

Lines changed: 40 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -5,44 +5,46 @@ A nodejs directory walker. Broadcasts events for various file types as well as
55
a generic "entry" event for all types and provides the ability to prune
66
directory trees. This shows the entire API; everything is optional:
77

8-
Walker('/etc/')
9-
.filterDir(function(dir, stat) {
10-
if (dir === '/etc/pam.d') {
11-
console.warn('Skipping /etc/pam.d and children')
12-
return false
13-
}
14-
return true
15-
})
16-
.on('entry', function(entry, stat) {
17-
console.log('Got entry: ' + entry)
18-
})
19-
.on('dir', function(dir, stat) {
20-
console.log('Got directory: ' + dir)
21-
})
22-
.on('file', function(file, stat) {
23-
console.log('Got file: ' + file)
24-
})
25-
.on('symlink', function(symlink, stat) {
26-
console.log('Got symlink: ' + symlink)
27-
})
28-
.on('blockDevice', function(blockDevice, stat) {
29-
console.log('Got blockDevice: ' + blockDevice)
30-
})
31-
.on('fifo', function(fifo, stat) {
32-
console.log('Got fifo: ' + fifo)
33-
})
34-
.on('socket', function(socket, stat) {
35-
console.log('Got socket: ' + socket)
36-
})
37-
.on('characterDevice', function(characterDevice, stat) {
38-
console.log('Got characterDevice: ' + characterDevice)
39-
})
40-
.on('error', function(er, entry, stat) {
41-
console.log('Got error ' + er + ' on entry ' + entry)
42-
})
43-
.on('end', function() {
44-
console.log('All files traversed.')
45-
})
8+
```javascript
9+
Walker('/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+
```
4648

4749
You specify a root directory to walk and optionally specify a function to prune
4850
sub-directory trees via the `filterDir` function. The Walker exposes a number

0 commit comments

Comments
 (0)