Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

152
Views
reader.readAsDataURL() not working on iOS or Android but in Browser

I want to get a base64-String from an firebase hostet image-URL. It's working well on all Browsers, but not when I'm building an iOS or Android App with ionic.

getDataUrl(url) {
    return new Promise(function (resolve, reject) {
      var request = new XMLHttpRequest();
      request.open('GET', url, true);
      request.responseType = 'blob';
      request.onload = function () {
        var reader = new FileReader();
        reader.readAsDataURL(request.response);
        reader.onload = function (e) {
          console.log('DataURL:', e.target.result);
          resolve(e.target.result)
        };
        reader.onerror= function (e) {
          console.log('Error:', e.target.error.code);
          reject(e.target.result)
        };
      };
      request.send();
    });
  }

Unfortunately it seems to stop at reader.readAsDataURL(request.response); but there is no logged error to check.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Had to add this:

  if (request.response instanceof Blob) {
          const realFileReader = (reader as any)._realReader;
          if (realFileReader) {
            reader = realFileReader;
          }
        }

from https://github.com/danielsogl/awesome-cordova-plugins/issues/505#issuecomment-698831447

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!