Skip to content
This repository has been archived by the owner on May 25, 2021. It is now read-only.

fix: update to unzip-stream #27

Merged
merged 5 commits into from
May 4, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 0 additions & 28 deletions .travis.yml

This file was deleted.

1 change: 1 addition & 0 deletions ci/Jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
javascript()
12 changes: 0 additions & 12 deletions circle.yml

This file was deleted.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"gunzip-maybe": "^1.4.1",
"request": "^2.85.0",
"tar-fs": "^1.16.0",
"unzip": "^0.1.11"
"unzip-stream": "^0.3.0"
},
"keywords": [
"ipfs",
Expand Down
14 changes: 7 additions & 7 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const gunzip = require('gunzip-maybe')
const path = require('path')
const request = require('request')
const tarFS = require('tar-fs')
const unzip = require('unzip')
const unzip = require('unzip-stream')
const support = require('./check-support')
const pkg = require('./../package.json')

Expand Down Expand Up @@ -103,14 +103,14 @@ function download (version, platform, arch, installPath) {
reject(new Error(`${res.statusCode} - ${res.body}`))
}
})
.on('response', (res) => {
.on('response', (res) => {
// Unpack only if the request was successful
if (res.statusCode !== 200) {
return
}
if (res.statusCode !== 200) {
return
}

unpack(res)
})
unpack(res)
})
})
}

Expand Down
10 changes: 5 additions & 5 deletions test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ test('Ensure ipfs gets downloaded (current version and platform)', (t) => {
t.ifErr(err)
t.ok(res.fileName.indexOf(`ipfs_${version}_${goenv.GOOS}-${goenv.GOARCH}`) !== -1, 'Returns the correct filename')

t.ok(res.installPath === path.resolve(__dirname, '../', 'go-ipfs') + '/', 'Returns the correct output path')
t.ok(res.installPath === path.resolve(__dirname, '../', 'go-ipfs') + path.sep, 'Returns the correct output path')

fs.stat(dir, (err, stats) => {
t.error(err, 'go-ipfs should stat without error')
Expand All @@ -63,7 +63,7 @@ test('Ensure Windows version gets downloaded', (t) => {
download(version, 'windows', (err, res) => {
t.ifErr(err)
t.ok(res.fileName.indexOf(`ipfs_${version}_windows-${goenv.GOARCH}`) !== -1, 'Returns the correct filename')
t.ok(res.installPath === path.resolve(__dirname, '../', 'go-ipfs') + '/', 'Returns the correct output path')
t.ok(res.installPath === path.resolve(__dirname, '../', 'go-ipfs') + path.sep, 'Returns the correct output path')

fs.stat(dir, (err, stats) => {
t.error(err, 'go-ipfs for windows should stat without error')
Expand All @@ -84,7 +84,7 @@ test('Ensure Linux version gets downloaded', (t) => {
download(version, 'linux', (err, res) => {
t.ifErr(err)
t.ok(res.fileName.indexOf(`ipfs_${version}_linux-${goenv.GOARCH}`) !== -1, 'Returns the correct filename')
t.ok(res.installPath === path.resolve(__dirname, '../', 'go-ipfs') + '/', 'Returns the correct output path')
t.ok(res.installPath === path.resolve(__dirname, '../', 'go-ipfs') + path.sep, 'Returns the correct output path')

fs.stat(dir, (err, stats) => {
t.error(err, 'go-ipfs for linux should stat without error')
Expand All @@ -105,7 +105,7 @@ test('Ensure OSX version gets downloaded', (t) => {
download(version, 'darwin', (err, res) => {
t.ifErr(err)
t.ok(res.fileName.indexOf(`ipfs_${version}_darwin-${goenv.GOARCH}`) !== -1, 'Returns the correct filename')
t.ok(res.installPath === path.resolve(__dirname, '../', 'go-ipfs') + '/', 'Returns the correct output path')
t.ok(res.installPath === path.resolve(__dirname, '../', 'go-ipfs') + path.sep, 'Returns the correct output path')

fs.stat(dir, (err, stats) => {
t.error(err, 'go-ipfs for OSX should stat without error')
Expand Down Expand Up @@ -133,7 +133,7 @@ test('Ensure TARGET_OS, TARGET_VERSION and TARGET_ARCH version gets downloaded',
download((err, res) => {
t.ifErr(err)
t.ok(res.fileName.indexOf(`ipfs_${process.env.TARGET_VERSION}_${process.env.TARGET_OS}-${process.env.TARGET_ARCH}`) !== -1, 'Returns the correct filename')
t.ok(res.installPath === path.resolve(__dirname, '../', 'go-ipfs') + '/', 'Returns the correct output path')
t.ok(res.installPath === path.resolve(__dirname, '../', 'go-ipfs') + path.sep, 'Returns the correct output path')

fs.stat(dir, (err, stats) => {
t.error(err, 'go-ipfs for windows should stat without error')
Expand Down