From dd526b042d97cd1ad015372d3b43c08687f30831 Mon Sep 17 00:00:00 2001 From: Adam Burgess Date: Fri, 15 Jul 2016 19:45:29 +1000 Subject: [PATCH] replace tar with tar-fs: ~40% faster unpack --- github.js | 16 +++++++--------- package.json | 2 +- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/github.js b/github.js index c169733..decab50 100644 --- a/github.js +++ b/github.js @@ -8,7 +8,7 @@ var expandTilde = require('expand-tilde'); var Promise = require('bluebird'); var asp = require('bluebird').Promise.promisify; -var tar = require('tar'); +var tar = require('tar-fs'); var zlib = require('zlib'); var semver = require('semver'); @@ -561,15 +561,13 @@ GithubLocation.prototype = { pkgRes .pipe(gzip) - .pipe(tar.Extract({ - path: outDir, - strip: 1, - filter: function() { - return !this.type.match(/^.*Link$/); + .pipe(tar.extract(outDir, { + strip: 1, + filter: function(_, header) { + return header.type !== 'file' && header.type !== 'directory' } - })) - .on('error', reject) - .on('end', resolve); + }).on('finish', resolve).on('error', reject)) + .on('error', reject); pkgRes.resume(); diff --git a/package.json b/package.json index c9e71d1..f0d13df 100644 --- a/package.json +++ b/package.json @@ -24,7 +24,7 @@ "request": "~2.53.0", "rimraf": "~2.3.2", "semver": "^5.0.1", - "tar": "^2.2.1", + "tar-fs": "^1.13.0", "which": "^1.0.9" }, "homepage": "https://github.com/jspm/github",