Speed up downloads by combining multiple network connections in parallel
TypeScript bandwidth-aggregationcross-platformdesktop-appdownloaderdownloadmanagerlinuxmacosmulticonnectionparallel-downloadswindows
fix: cap the saved destination folder check at startup
Anmol Kapil765964ff5eb3
diff --git a/src/main/ipc/handlers.ts b/src/main/ipc/handlers.tsindex 83e52d0..54ddbe2 100644--- a/src/main/ipc/handlers.ts+++ b/src/main/ipc/handlers.ts@@ -55,6 +55,8 @@ function handle<K extends keyof IpcContract>()}+const DESTINATION_CHECK_MS = 300+export function registerIpcHandlers(getWindow: () => BrowserWindow | null): DownloadManager {let cachedInterfaces: NetworkInterfaceInfo[] = []@@ -107,12 +109,17 @@ export function registerIpcHandlers(getWindow: () => BrowserWindow | null): DownloadNetworkPreferences()])const { destinationDir } = settings+ // Capped: a folder on a dropped network share can take many seconds to answer, and launch+ // waits on this reply — past the cap it's treated as gone and Downloads is used instead.const destinationExists =typeof destinationDir === 'string' &&- (await stat(destinationDir).then(- (stats) => stats.isDirectory(),- () => false- ))+ (await Promise.race([+ stat(destinationDir).then(+ (stats) => stats.isDirectory(),+ () => false+ ),+ new Promise<boolean>((resolve) => setTimeout(resolve, DESTINATION_CHECK_MS, false))+ ]))event.returnValue = {...paths(),themeSource: currentThemeSource(),