Permalink
Browse files

Add 'stat' event before 'ready'

  • Loading branch information...
1 parent c56946f commit 19d266d6f6c81132202839a4c83d893c3224b723 @isaacs isaacs committed Mar 26, 2012
Showing with 10 additions and 1 deletion.
  1. +1 −0 lib/proxy-reader.js
  2. +9 −1 lib/reader.js
View
@@ -63,6 +63,7 @@ ProxyReader.prototype._addProxy = function (proxy) {
, "child"
, "childEnd"
, "warn"
+ , "stat"
].forEach(function (ev) {
// console.error("~~ proxy event", ev, me.path)
proxy.on(ev, me.emit.bind(me, ev))
View
@@ -199,10 +199,18 @@ Reader.prototype._stat = function (currentStat) {
}
}
+ // last chance to abort or disown before the flow starts!
+ me.emit("stat", props)
+ if (me._aborted) {
+ me.emit("end")
+ me.emit("close")
+ return
+ }
+
me.emit("ready", props)
// if it's a directory, then we'll be emitting "entry" events.
- me._read()
+ if (!me._paused) me._read()
}
}

0 comments on commit 19d266d

Please sign in to comment.