Uploaded image for project: 'Help-Desk'
  1. Help-Desk
  2. HELP-4268

FIWARE.Question.Tech.Apps.ApplicationMashup.BlobFromObjectStorage

    Details

      Description

      Created question in FIWARE Q/A platform on 26-06-2014 at 18:06
      Please, ANSWER this question AT http://stackoverflow.com/questions/24436153/download-blob-from-fiware-object-storage

      Question:
      Download blob from fiware object-storage

      Description:
      I am facing problems using ObjectStorageAPI to manage files in FIWARE object storage.
      Having written a set of widgets/operators that create images and upload them onto object-storage, I would like to be able to download these files at any given instance. However, it seems that i am not able to do so.

      After having been authenticated, i list the container contents and, then, i try to download the file i need, specified by the global variable file_name, as follows:

      function onGetAuthTokenSuccess(new_token, data){
      ...
      api = new ObjectStorageAPI(object_storage);
      api.listContainer(container, {
      token: token,
      onSuccess: onListContainterSuccess,
      onFailure: function ()

      { alert("Could not find container " + container + " in region " + region); }

      });
      }

      function onListContainterSuccess(file_list) {
      api.getFile(container, file_name, {
      token: token,
      onSuccess: onDownloadFileSuccess,
      onFailure: function ()

      { alert("Could not successfully download " + file_name); }

      });
      }

      function onDownloadFileSuccess(blob){
      console.log(JSON.stringify(blob));
      ....
      }

      Running the above code results in an output like the following:

      {"type":"image/png","size":45590}

      Without any other information given.

      At the same time, my browser's network monitor suggests that the transaction actually took place correctly as the (unformatted and shrinked) response payload was:

      {"mimetype":"image/png","metadata":{},"valuetransferencoding":"base64","value":"iVBORw0KGgoAAAANSUhEUgAAA0MAAAE2CAYAAACjsEm0AAAgAElEQVR4Xux9CZgU1dX26Z5935kZlmGTRTZl00iMS4iExEQ0RI2JCyayCAqCGCIiYlBj0KhgDEKQfMQvGvJnUYwmBv0kMQaMISoo+47sMiyzz3RP.....m1YaNpGAAAAABJRU5ErkJggg=="}

      The HTTP status is either 200 or 304, which should be considered normal.
      Please note that i am able to download the requested file normally via the fiware portal UI.

      Any ideas on how i should proceed to actually get the file in a correct manner?

        Activity

        There are no comments yet on this issue.

          People

          • Assignee:
            aarranz Álvaro Arranz
            Reporter:
            backlogmanager Backlog Manager
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: