Skip to content
This repository was archived by the owner on Aug 11, 2021. It is now read-only.

Commit a67b90b

Browse files
rvaggothiym23
authored andcommitted
dir-reader: revert a55ae72
Unnecessary when collect() handles pause/resume state properly, this compounds the issue and adds unnecessary entries to the list. Credit: @rvagg Reviewed-By: @othiym23 PR-URL: #53
1 parent 688cf00 commit a67b90b

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

lib/dir-reader.js

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ function DirReader (props) {
2424
}
2525

2626
self.entries = null
27-
self._entries = []
2827
self._index = -1
2928
self._paused = false
3029
self._length = -1
@@ -48,7 +47,6 @@ DirReader.prototype._getEntries = function () {
4847
if (er) return self.error(er)
4948

5049
self.entries = entries
51-
self._entries = entries.slice()
5250

5351
self.emit('entries', entries)
5452
if (self._paused) self.once('resume', processEntries)
@@ -76,7 +74,7 @@ DirReader.prototype._read = function () {
7674
}
7775

7876
self._index++
79-
if (self._index >= self._entries.length) {
77+
if (self._index >= self.entries.length) {
8078
if (!self._ended) {
8179
self._ended = true
8280
self.emit('end')
@@ -85,14 +83,12 @@ DirReader.prototype._read = function () {
8583
return
8684
}
8785

88-
// save creating a proxy, by stat'ing the thing now.
89-
var nextEntry = self._entries[self._index]
90-
if (!nextEntry) return this._read()
91-
9286
// ok, handle this one, then.
93-
var p = path.resolve(self._path, nextEntry)
87+
88+
// save creating a proxy, by stat'ing the thing now.
89+
var p = path.resolve(self._path, self.entries[self._index])
9490
assert(p !== self._path)
95-
assert(nextEntry)
91+
assert(self.entries[self._index])
9692

9793
// set this to prevent trying to _read() again in the stat time.
9894
self._currentEntry = p

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy