mirror of
https://github.com/tenrok/axios.git
synced 2026-06-14 18:42:33 +03:00
feat(adapter): add fetch adapter; (#6371)
This commit is contained in:
@@ -65,19 +65,20 @@ class AxiosTransformStream extends stream.Transform{
|
||||
|
||||
process.nextTick(() => {
|
||||
self.emit('progress', {
|
||||
'loaded': bytesTransferred,
|
||||
'total': totalBytes,
|
||||
'progress': totalBytes ? (bytesTransferred / totalBytes) : undefined,
|
||||
'bytes': progressBytes,
|
||||
'rate': rate ? rate : undefined,
|
||||
'estimated': rate && totalBytes && bytesTransferred <= totalBytes ?
|
||||
(totalBytes - bytesTransferred) / rate : undefined
|
||||
loaded: bytesTransferred,
|
||||
total: totalBytes,
|
||||
progress: totalBytes ? (bytesTransferred / totalBytes) : undefined,
|
||||
bytes: progressBytes,
|
||||
rate: rate ? rate : undefined,
|
||||
estimated: rate && totalBytes && bytesTransferred <= totalBytes ?
|
||||
(totalBytes - bytesTransferred) / rate : undefined,
|
||||
lengthComputable: totalBytes != null
|
||||
});
|
||||
});
|
||||
}, internals.ticksRate);
|
||||
|
||||
const onFinish = () => {
|
||||
internals.updateProgress(true);
|
||||
internals.updateProgress.call(true);
|
||||
};
|
||||
|
||||
this.once('end', onFinish);
|
||||
|
||||
Reference in New Issue
Block a user