in www/FileReader.js [131:181]
function readSuccessCallback (readType, encoding, offset, totalSize, accumulate, r) {
if (this._readyState === FileReader.DONE) {
return;
}
let CHUNK_SIZE = FileReader.READ_CHUNK_SIZE;
if (readType === 'readAsDataURL') {
// Windows proxy does not support reading file slices as Data URLs
// so read the whole file at once.
CHUNK_SIZE = cordova.platformId === 'windows'
? totalSize
: (
// Calculate new chunk size for data URLs to be multiply of 3
// Otherwise concatenated base64 chunks won't be valid base64 data
FileReader.READ_CHUNK_SIZE - (FileReader.READ_CHUNK_SIZE % 3) + 3
);
}
if (typeof r !== 'undefined') {
accumulate(r);
this._progress = Math.min(this._progress + CHUNK_SIZE, totalSize);
if (typeof this.onprogress === 'function') {
this.onprogress(new ProgressEvent('progress', { loaded: this._progress, total: totalSize }));
}
}
if (typeof r === 'undefined' || this._progress < totalSize) {
const execArgs = [
this._localURL,
offset + this._progress,
offset + this._progress + Math.min(totalSize - this._progress, CHUNK_SIZE)];
if (encoding) {
execArgs.splice(1, 0, encoding);
}
exec(
readSuccessCallback.bind(this, readType, encoding, offset, totalSize, accumulate),
readFailureCallback.bind(this),
'File', readType, execArgs);
} else {
this._readyState = FileReader.DONE;
if (typeof this.onload === 'function') {
this.onload(new ProgressEvent('load', { target: this }));
}
if (typeof this.onloadend === 'function') {
this.onloadend(new ProgressEvent('loadend', { target: this }));
}
}
}