increase chunk size for uploading files
This commit is contained in:
parent
b832ae5a95
commit
71528010d9
|
@ -1,3 +1,5 @@
|
||||||
|
const FILE_CHUNK_SIZE = 16384;
|
||||||
|
|
||||||
let files = [];
|
let files = [];
|
||||||
|
|
||||||
let socket = null;
|
let socket = null;
|
||||||
|
@ -31,7 +33,7 @@ function sendData() {
|
||||||
}
|
}
|
||||||
const currentFile = files[fileIndex];
|
const currentFile = files[fileIndex];
|
||||||
if (byteIndex < currentFile.size) {
|
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);
|
const data = currentFile.slice(byteIndex, endpoint);
|
||||||
socket.send(data);
|
socket.send(data);
|
||||||
byteIndex = endpoint;
|
byteIndex = endpoint;
|
||||||
|
|
Loading…
Reference in a new issue