Skip to content

Commit

Permalink
fix(update): Fix downloading
Browse files Browse the repository at this point in the history
Switching to native version of http for downloading files
  • Loading branch information
evansiroky committed May 21, 2016
1 parent 7f53ded commit 895b304
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
14 changes: 9 additions & 5 deletions lib/update.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
var fs = require('fs')
var fs = require('fs'),
http = require('http')

var async = require('async'),
download = require('get-down'),
rimraf = require('rimraf'),
shp = require('shpjs')

Expand Down Expand Up @@ -36,9 +36,13 @@ var downloadFile = function(url, rename, callback) {
rimraf(dlFile, cb)
},
dl: ['rm', function(results, cb) {
download(url, { dest: dlFile } )
.on('end', function(dest) { cb() })
.on('error', cb)
var file = fs.createWriteStream(dlFile)
http.get(url, function(response) {
response.pipe(file)
file.on('finish', function() {
file.close(cb)
})
}).on('error', cb)
}]
}, callback)

Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
"codeclimate-test-reporter": "^0.3.1",
"cross-env": "^1.0.7",
"fs-extra": "^0.30.0",
"get-down": "^1.1.0",
"istanbul": "^0.4.2",
"jsts": "^1.1.2",
"lodash": "^4.11.2",
Expand Down

0 comments on commit 895b304

Please sign in to comment.