summaryrefslogtreecommitdiff
path: root/deps/npm/node_modules/fstream/examples/reader.js
blob: 73075102f4421f2fa35040b866c65875cd8fcb6b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
var fstream = require("../fstream.js")
var path = require("path")

var r = fstream.Reader({ path: path.dirname(__dirname)
                       , filter: function () {
                           return !this.basename.match(/^\./)
                         }
                       })

console.error(r instanceof fstream.Reader)
console.error(r instanceof require("stream").Stream)
console.error(r instanceof require("events").EventEmitter)
console.error(r.on)

r.on("stat", function () {
  console.error("a %s !!!\t", r.type, r.path)
})

r.on("entries", function (entries) {
  console.error("\t" + entries.join("\n\t"))
})

r.on("entry", function (entry) {
  console.error("a %s !!!\t", entry.type, entry.path)
})

r.on("end", function () {
  console.error("IT'S OVER!!")
})