(file, onChunk, onPartitionEnd)
| 423 | class FileChunker { |
| 424 | |
| 425 | constructor(file, onChunk, onPartitionEnd) { |
| 426 | this._chunkSize = 64000; // 64 KB |
| 427 | this._maxPartitionSize = 1e6; // 1 MB |
| 428 | this._offset = 0; |
| 429 | this._partitionSize = 0; |
| 430 | this._file = file; |
| 431 | this._onChunk = onChunk; |
| 432 | this._onPartitionEnd = onPartitionEnd; |
| 433 | this._reader = new FileReader(); |
| 434 | this._reader.addEventListener('load', e => this._onChunkRead(e.target.result)); |
| 435 | } |
| 436 | |
| 437 | nextPartition() { |
| 438 | this._partitionSize = 0; |
nothing calls this directly
no test coverage detected