Loading saved files from the internet does not work on device?

I’m downloading photos from the internet, saving them on the device, then displaying them.
This works on Fuse on my Mac, but I’ve been testing it on my actual device, both on Fuse app, and compiling in XCode and deploying on the device, and it’s the same thing.

Here’s the error reported:

Here’s how I download the files and save them:

var oReq = new XMLHttpRequest();
oReq.open(“GET”, item, true);
oReq.responseType = “arraybuffer”;
oReq.onload = function (oEvent) {

var arrayBuffer = oReq.response;
if (arrayBuffer) {

  var path = FileSystem.dataDirectory + "/" + fname.replace(" ","_");
  FileSystem.writeBufferToFile(path, arrayBuffer);



And here’s how I find the path to display as observable:

var imgUrl = data.objects[i].Photo;
// replaces spaces with url friendly format
imgUrl = decodeURIComponent(imgUrl);
// just get the filename
var img = imgUrl.substring(imgUrl.lastIndexOf(‘/’)+1,imgUrl.lastIndexOf(‘.’)+4);
// replace spaces with underscores
img = img.replace(" “,”_")
// create object LocalPhoto with local URL of file where it was downloaded
data.objects[i].LocalPhoto = FileSystem.dataDirectory + “/” + img;


Any ideas?

Hello! I’ve been using this on all devices successfully:

fetch("https://www.example.com/base64image.php", {
      method: "POST",
      headers: {
        "pragma": "no-cache",
        "cache-control": "no-cache"
    }).then(function(response) {

      if (response.status == 200) {return response._bodyText;}

    }).then(function(data) {

      try {

        Storage.write("image.jpg", data).then(function (success) {

          if (success) {

            ImageTools.getImageFromBase64(data).then(function(image) {

              // image.path contains the path to the image




      } catch (err) {

        // error



So turns out it wasnt Fuse to blame, it was my local python server, which changed IP when I changed WiFi. All is good.