Skip to content

Commit

Permalink
Fixed raise error event when paused in newer nodejs versions #62
Browse files Browse the repository at this point in the history
  • Loading branch information
hgouveia committed Aug 24, 2021
1 parent 9d1bd9c commit 305676e
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -955,8 +955,17 @@ export class DownloaderHelper extends EventEmitter {
* @memberof DownloaderHelper
*/
__requestAbort() {
if (this.__response) {
this.__response.destroy();
}

if (this.__request) {
this.__request.abort();
// from node => v13.14.X
if (this.__request.destroy) {
this.__request.destroy();
} else {
this.__request.abort();
}
}
}
}

0 comments on commit 305676e

Please sign in to comment.