0

I am storing a lot of images in my App to be able to use them later without downloading them again. Currently, I am converting them in base64 then storing them in the local storage of the device (more and less working since I struggle with the unsafe value from angular).

But I just read that base64 images were larger? What is the best way to store and display a lot of images (~50 images, from 150KB to 2MB)?

Dinal Koyani
  • 455
  • 3
  • 6
Niavart
  • 132
  • 2
  • 15

1 Answers1

1
You can use the plugin cordova-plugin-file for saving file  locally to your phone.

Like this
var url = url;
    var targetPath = cordova.file.externalDataDirectory + NAME;
    //alert(targetPath);
    var trustHosts = true;
    var options = {};

$cordovaFileTransfer.download(url, targetPath, options, trustHosts)
Jyothish
  • 167
  • 1
  • 8
  • That's what I ended up doing, but I was still encoding in base64 because I was using the s3.getobject() function. Will try to get the url and download with cordova. – Niavart Nov 02 '17 at 09:41