From 840c460a2a1f73f1fb17a14df541629459d56bcb Mon Sep 17 00:00:00 2001 From: Stepan Mikhailiuk Date: Wed, 18 Oct 2023 10:56:12 -0700 Subject: [PATCH] fix(*): handle timeout --- src/DownloadVideoURL.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/DownloadVideoURL.ts b/src/DownloadVideoURL.ts index 322eff3..37df745 100644 --- a/src/DownloadVideoURL.ts +++ b/src/DownloadVideoURL.ts @@ -62,6 +62,11 @@ export class DownloadVideoURL { } reject(e); }); + + this.#httpRequest.on('timeout', () => { + this.#httpRequest.destroy(); + reject(new Error(`Request to ${source} timed out`)); + }); } catch (e) { reject(e);