mirror of
https://github.com/lovell/sharp.git
synced 2025-07-10 11:00:14 +02:00
Migrate from got to simple-get (#945)
The simple-get module provides support for basic auth and is already used by the future prebuild dependency.
This commit is contained in:
parent
5f29d1ba9c
commit
0004f5d2ff
17
binding.js
17
binding.js
@ -5,7 +5,7 @@ const os = require('os');
|
||||
const path = require('path');
|
||||
|
||||
const caw = require('caw');
|
||||
const got = require('got');
|
||||
const simpleGet = require('simple-get');
|
||||
const semver = require('semver');
|
||||
const tar = require('tar');
|
||||
const detectLibc = require('detect-libc');
|
||||
@ -95,19 +95,22 @@ module.exports.download_vips = function () {
|
||||
} catch (err) {}
|
||||
});
|
||||
});
|
||||
const gotOpt = {
|
||||
const url = distBaseUrl + tarFilename;
|
||||
const simpleGetOpt = {
|
||||
url: url,
|
||||
agent: caw(null, {
|
||||
protocol: 'https'
|
||||
})
|
||||
};
|
||||
const url = distBaseUrl + tarFilename;
|
||||
got.stream(url, gotOpt).on('response', function (response) {
|
||||
simpleGet(simpleGetOpt, function (err, response) {
|
||||
if (err) {
|
||||
error('Download of ' + url + ' failed: ' + err.message);
|
||||
}
|
||||
if (response.statusCode !== 200) {
|
||||
error(url + ' status code ' + response.statusCode);
|
||||
}
|
||||
}).on('error', function (err) {
|
||||
error('Download of ' + url + ' failed: ' + err.message);
|
||||
}).pipe(tmpFile);
|
||||
response.pipe(tmpFile);
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -70,9 +70,9 @@
|
||||
"caw": "^2.0.0",
|
||||
"color": "^2.0.0",
|
||||
"detect-libc": "^0.2.0",
|
||||
"got": "^7.1.0",
|
||||
"nan": "^2.6.2",
|
||||
"semver": "^5.3.0",
|
||||
"simple-get": "^2.7.0",
|
||||
"tar": "^3.1.5"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
Loading…
x
Reference in New Issue
Block a user