|
@@ -9,11 +9,12 @@ class FileDownloader {
|
|
this.limitDownloadSize = limitDownloadSize;
|
|
this.limitDownloadSize = limitDownloadSize;
|
|
}
|
|
}
|
|
|
|
|
|
- async load(url, callback, abort) {
|
|
|
|
|
|
+ async load(url, opts, callback, abort) {
|
|
let errMes = '';
|
|
let errMes = '';
|
|
|
|
|
|
- const options = {
|
|
|
|
|
|
+ let options = {
|
|
headers: {
|
|
headers: {
|
|
|
|
+ 'accept-encoding': 'gzip, compress, deflate',
|
|
'user-agent': userAgent,
|
|
'user-agent': userAgent,
|
|
timeout: 300*1000,
|
|
timeout: 300*1000,
|
|
},
|
|
},
|
|
@@ -22,6 +23,8 @@ class FileDownloader {
|
|
}),
|
|
}),
|
|
responseType: 'stream',
|
|
responseType: 'stream',
|
|
};
|
|
};
|
|
|
|
+ if (opts)
|
|
|
|
+ options = Object.assign({}, opts, options);
|
|
|
|
|
|
try {
|
|
try {
|
|
const res = await axios.get(url, options);
|
|
const res = await axios.get(url, options);
|