Open allout58 opened 3 years ago
I'm trying to use the .on('progress', cb) method for a download in my Node application, but the callback function is never called. For uploads, .on('progress', cb) works just fine.
.on('progress', cb)
Relevant versions:
Download example (does not work):
agent() .get(downloadUrl) .maxResponseSize(this.maxDownloadSize ?? 200_000_000) .on('progress', ev => { console.log('Progress: ', ev.loaded); }) .then(r => { console.log("Response body: ', r.body); });
Upload example (works):
agent() .post(uploadUrl) .attach('file1', bufferToUpload, {filename: 'thing1.zip', contentType: 'application/zip'}) .on('progress', ev => { console.log('Progress: ', ev.loaded); }) .then(r => { console.log("Response body: ', r.body); });
I met the same problem.
I'm trying to use the
.on('progress', cb)
method for a download in my Node application, but the callback function is never called. For uploads,.on('progress', cb)
works just fine.Relevant versions:
Download example (does not work):
Upload example (works):