From 71528010d91f40b69ebd92257dd90255ffabdde3 Mon Sep 17 00:00:00 2001 From: xenofem Date: Wed, 27 Apr 2022 20:32:35 -0400 Subject: [PATCH] increase chunk size for uploading files --- static/upload.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/static/upload.js b/static/upload.js index 95c7a94..3784d9d 100644 --- a/static/upload.js +++ b/static/upload.js @@ -1,3 +1,5 @@ +const FILE_CHUNK_SIZE = 16384; + let files = []; let socket = null; @@ -31,7 +33,7 @@ function sendData() { } const currentFile = files[fileIndex]; if (byteIndex < currentFile.size) { - const endpoint = Math.min(byteIndex+8192, currentFile.size); + const endpoint = Math.min(byteIndex+FILE_CHUNK_SIZE, currentFile.size); const data = currentFile.slice(byteIndex, endpoint); socket.send(data); byteIndex = endpoint;