Skip to content

Commit

Permalink
stopped using node-tar
Browse files Browse the repository at this point in the history
  • Loading branch information
watilde committed Jul 26, 2017
1 parent 61ae9ef commit 1981d36
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 21 deletions.
38 changes: 18 additions & 20 deletions lib/install/installer/registry.js
Original file line number Diff line number Diff line change
@@ -1,26 +1,24 @@
const https = require('https')
const tar = require('tar')
const { URL } = require('url')
const request = require('request')
const tar = require('tar-fs')
const fs = require('fs')
const gunzip = require('gunzip-maybe')
const npmrc = require('../../utils/npmrc')

module.exports = (pkg, cwd) => {
const url = new URL(pkg.tarball)
const options = {
url: pkg.tarball,
headers: {
'User-Agent': npmrc.userAgent
}
}
return new Promise((resolve, reject) => {
https.get({
host: url.host,
path: url.pathname,
headers: npmrc.userAgent
}, (res) => {
res.pipe(
tar.extract({
cwd: cwd,
sync: true,
strip: 1
})
)
res.on('end', () => {
resolve()
})
}).on('error', reject)
const extract = tar.extract(cwd, {strip: 1})
extract.on('finish', function() {
resolve()
})
request.get(options)
.pipe(gunzip())
.pipe(extract)
.on('error', reject)
})
}
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
"request": "^2.81.0",
"require-directory": "^2.1.1",
"semver": "^5.3.0",
"tar": "^3.1.5",
"tar-fs": "^1.15.3",
"tar-stream": "^1.5.4",
"which": "^1.2.14",
Expand Down

0 comments on commit 1981d36

Please sign in to comment.