Skip to content
Browse files

Update fstream

  • Loading branch information...
1 parent 4ca6aa6 commit d3eb770edf8d2cf0376b4f526a4d4a8da5eb387f @isaacs isaacs committed Mar 27, 2012
Showing with 25 additions and 13 deletions.
  1. +5 −1 node_modules/fstream/lib/dir-reader.js
  2. +17 −9 node_modules/fstream/lib/reader.js
  3. +3 −3 node_modules/fstream/package.json
View
6 node_modules/fstream/lib/dir-reader.js
@@ -130,7 +130,11 @@ DirReader.prototype._read = function () {
})
entry.on("stat", function (props) {
- me.emit("entryStat", entry, props)
+ me.emit("_entryStat", entry, props)
+ if (entry._aborted) return
+ if (entry._paused) entry.once("resume", function () {
+ me.emit("entryStat", entry, props)
+ })
})
entry.on("ready", function EMITCHILD () {
View
26 node_modules/fstream/lib/reader.js
@@ -200,17 +200,25 @@ 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
- }
+ var events = ["_stat", "stat", "ready"]
+ var e = 0
+ ;(function go () {
+ if (me._aborted) {
+ me.emit("end")
+ me.emit("close")
+ return
+ }
- me.emit("ready", props)
+ if (me._paused) {
+ me.once("resume", go)
+ return
+ }
- // if it's a directory, then we'll be emitting "entry" events.
- if (!me._paused) me._read()
+ var ev = events[e ++]
+ if (!ev) return me._read()
+ me.emit(ev, props)
+ go()
+ })()
}
}
View
6 node_modules/fstream/package.json
@@ -6,7 +6,7 @@
},
"name": "fstream",
"description": "Advanced file system stream things",
- "version": "0.1.16",
+ "version": "0.1.17",
"repository": {
"type": "git",
"url": "git://github.com/isaacs/fstream.git"
@@ -32,11 +32,11 @@
"name": "isaacs",
"email": "i@izs.me"
},
- "_id": "fstream@0.1.16",
+ "_id": "fstream@0.1.17",
"optionalDependencies": {},
"_engineSupported": true,
"_npmVersion": "1.1.12",
"_nodeVersion": "v0.7.7-pre",
"_defaultsLoaded": true,
- "_from": "fstream@~0.1.15"
+ "_from": "fstream@~0.1.16"
}

0 comments on commit d3eb770

Please sign in to comment.
Something went wrong with that request. Please try again.