New max limit for files
This commit is contained in:
parent
1cf83c2485
commit
6d98014ad2
@ -49,12 +49,11 @@ self.addEventListener("message", function(e) {
|
|||||||
*/
|
*/
|
||||||
self.loadFile = function(file, inputNum) {
|
self.loadFile = function(file, inputNum) {
|
||||||
const reader = new FileReader();
|
const reader = new FileReader();
|
||||||
let data;
|
if (file.size >= 256*256*256*127) {
|
||||||
try {
|
self.port.postMessage({"error": "File size too large.", "inputNum": inputNum, "id": self.id});
|
||||||
data = new Uint8Array(file.size);
|
return;
|
||||||
} catch (err) {
|
|
||||||
self.port.postMessage({"error": err, "inputNum": inputNum});
|
|
||||||
}
|
}
|
||||||
|
const data = new Uint8Array(file.size);
|
||||||
let offset = 0;
|
let offset = 0;
|
||||||
const CHUNK_SIZE = 10485760; // 10MiB
|
const CHUNK_SIZE = 10485760; // 10MiB
|
||||||
|
|
||||||
@ -63,7 +62,7 @@ self.loadFile = function(file, inputNum) {
|
|||||||
self.port.postMessage({"fileBuffer": data.buffer, "inputNum": inputNum, "id": self.id}, [data.buffer]);
|
self.port.postMessage({"fileBuffer": data.buffer, "inputNum": inputNum, "id": self.id}, [data.buffer]);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// self.port.postMessage({"progress": Math.round(offset / file.size * 100), "inputNum": inputNum});
|
self.port.postMessage({"progress": Math.round(offset / file.size * 100), "inputNum": inputNum});
|
||||||
const slice = file.slice(offset, offset + CHUNK_SIZE);
|
const slice = file.slice(offset, offset + CHUNK_SIZE);
|
||||||
reader.readAsArrayBuffer(slice);
|
reader.readAsArrayBuffer(slice);
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user