Hi all,
I’m trying to solve a simple problem but it seems in js it’s not that simple as expected
I have an app (Android, iOS) which is playing some videos which are downloaded from a server and locally stored.
For the download I use the FileTransferObject from ‘@ionic-native/file-transfer’ which works like expected.
await fileTransfer.download(source, this.filepath + dest)
.then((entry) => {
console.log('loaded: ' , entry );
entry.file(function (file) {
var reader = new FileReader();
reader.onloadend = function() {
console.log("Successful file read: " + this.result);
let tmp: ArrayBuffer = this.result;
console.log('tmp.byteLength: ', tmp.byteLength)
};
reader.readAsArrayBuffer(file);
});
}
At the end of the download I want to validate the local stored filesize against my stored file info which also has the size of the original file.
FileReader has not such a property and the byteLength is not the filesize.
Any hints how to get the size of a local stored file?
thx,
patrik