From 9fc84b9c596c3589d4c1ab050843de0eafb002e8 Mon Sep 17 00:00:00 2001 From: isaacs Date: Tue, 14 May 2019 17:08:01 -0700 Subject: [PATCH] Use {} for hardlink tracking instead of [] --- lib/parse.js | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/lib/parse.js b/lib/parse.js index e66c75da..e8d007ba 100644 --- a/lib/parse.js +++ b/lib/parse.js @@ -38,7 +38,7 @@ function Parse () { me._stream = new BlockStream(512) me.position = 0 me._ended = false - me._hardLinks = [] + me._hardLinks = {} me._stream.on("error", function (e) { me.emit("error", e) @@ -251,18 +251,14 @@ Parse.prototype._startEntry = function (c) { if (onend) entry.on("end", onend) - if (entry.type === "File") { - this._hardLinks.forEach(function(link) { - if (link.path === entry.path) { - ev = "ignoredEntry" - } - }) + if (entry.type === "File" && this._hardLinks[entry.path]) { + ev = "ignoredEntry" } this._entry = entry if (entry.type === "Link") { - this._hardLinks.push(entry) + this._hardLinks[entry.path] = entry } var me = this