Quantcast
Channel: Ionic Framework - Ionic Forum
Viewing all articles
Browse latest Browse all 49253

Sometimes the FileReader does not response

$
0
0

@Dovel wrote:

Is there a known issue of the FileReader in Ionic? In my case the FileReader is sometimes not responding.

let obj = { hello: 'world' };
let json = JSON.stringify(obj, null, 2);
let blob = new Blob([json], { type: 'application/json' });

let readBlob = function (data) {

  let reader = new FileReader();

  reader.onload = () => {
    console.log('Loaded: ', reader.result);
  };

  reader.onerror = error => {
    console.log('Error: ', error);
  };

  reader.onabort = () => {
    console.log('Aborted');
  };

  reader.readAsText(data);

};

readBlob(blob);

I wrapped the code in try-catch and print every single step. Sometimes there is no reaction of the FileReader. No event is fired. No errors.

Device: Android (5.1)

Ionic:

   ionic (Ionic CLI)  : 4.0.6
   Ionic Framework    : ionic-angular 3.9.2
   @ionic/app-scripts : 3.1.9

Cordova:

   cordova (Cordova CLI) : 8.0.0
   Cordova Platforms     : android 7.1.1

System:

   Android SDK Tools : 26.1.1
   NodeJS            : v8.11.3
   npm               : 5.6.0
   OS                : Windows 10

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 49253

Trending Articles



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