increase chunk size for uploading files

main
xenofem 2022-04-27 20:32:35 -04:00
parent b832ae5a95
commit 71528010d9
1 changed files with 3 additions and 1 deletions

View File

@ -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;