Hi all,
I have code as below.
If this.file.readAsArrayBuffer
in hasFile()
cannot resolve a file, an err is caught successfully. This is as what I expect.
however, if the file is resolved in hasFile()
, there is a chance that console.log('then: ' + values);
does not call. It means by random chances (like 50%) in ionic run android
in my real android tablet, the console.log('then: ' + values);
will not print out anything.
Why is this, really does not make sense for me.
process() {
Promise.all([this.hasFile(1)]).then(values => {
console.log('then: ' + values);
}).catch(err => console.log('err: ' + err));
}
hasFile(i: number): Promise<ArrayBuffer> {
console.log('in: ' + i);
let fileName: string = i + this.suffix;
return this.file.readAsArrayBuffer(this.file.externalDataDirectory, fileName);
}