From 43d4019860dc55dca8eb260de74b24e27dda447a Mon Sep 17 00:00:00 2001 From: C-3PO Date: Fri, 16 Nov 2018 16:37:07 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=8E=20Continue=20curl=20download=20whe?= =?UTF-8?q?re=20it=20left=20off?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/cdn/downloadWithCurl.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/cdn/downloadWithCurl.ts b/src/cdn/downloadWithCurl.ts index ffa9dee..c425411 100644 --- a/src/cdn/downloadWithCurl.ts +++ b/src/cdn/downloadWithCurl.ts @@ -16,7 +16,7 @@ export default function downloadWithCurl({ host, path, tempFileName }: {host: st const url = `http://${host}${(path[0] === '/' ? '' : '/')}${path}`; const parameters: string[] = [ - //... + '--continue-at', '-', '--silent', '--limit-rate', `${MAXIMUM_SPEED}m`, '--speed-limit', String(MINIMUM_SPEED * 1024 * 1024), @@ -36,7 +36,7 @@ export default function downloadWithCurl({ host, path, tempFileName }: {host: st if (code === 0) { resolve(tempFileName); } else if (code === 28) { - reject(`Download speed too slow, restarting "${path.includes('/') ? path.substr(path.lastIndexOf('/')) : path}".`); + reject(`Download speed too slow, restarting "${path.includes('/') ? path.substr(path.lastIndexOf('/') + 1) : path}".`); } else { reject(`Error in process:\n> curl ${parameters.join(' ')}\nNon-zero exit code ${code}.`); }