Quantcast
Channel: Ionic Forum - Latest topics
Viewing all articles
Browse latest Browse all 71531

File.readAsArrayBuffer promise issue

$
0
0

@danielle113 wrote:

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);
  }

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 71531

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>