mirror of
https://github.com/status-im/embark-area-51.git
synced 2025-02-20 02:58:05 +00:00
refactor httpsGet
This commit is contained in:
parent
bee4d0e1f2
commit
510bc2c542
@ -17,13 +17,7 @@ class Npm {
|
|||||||
let self = this;
|
let self = this;
|
||||||
let npmRegistry = "https://registry.npmjs.org/" + packageName + "/" + version;
|
let npmRegistry = "https://registry.npmjs.org/" + packageName + "/" + version;
|
||||||
|
|
||||||
utils.httpsGet(npmRegistry, function (res) {
|
utils.httpsGet(npmRegistry, function (body) {
|
||||||
|
|
||||||
let body = '';
|
|
||||||
res.on('data', function (d) {
|
|
||||||
body += d;
|
|
||||||
});
|
|
||||||
res.on('end', function () {
|
|
||||||
let registryJSON = JSON.parse(body);
|
let registryJSON = JSON.parse(body);
|
||||||
|
|
||||||
let tarball = registryJSON.dist.tarball;
|
let tarball = registryJSON.dist.tarball;
|
||||||
@ -101,7 +95,6 @@ class Npm {
|
|||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -37,7 +37,15 @@ function httpGet(url, callback) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function httpsGet(url, callback) {
|
function httpsGet(url, callback) {
|
||||||
return https.get(url, callback);
|
https.get(url, function(res) {
|
||||||
|
let body = '';
|
||||||
|
res.on('data', function (d) {
|
||||||
|
body += d;
|
||||||
|
});
|
||||||
|
res.on('end', function () {
|
||||||
|
callback(body);
|
||||||
|
});
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function runCmd(cmd, options) {
|
function runCmd(cmd, options) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user