Details
-
Type: Monitor
-
Status: Closed
-
Priority: Major
-
Resolution: Done
-
Affects Version/s: None
-
Fix Version/s: 2021
-
Component/s: FIWARE-TECH-HELP
-
Labels:
-
HD-Chapter:Apps
-
HD-Enabler:Wirecloud
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 ()
});
}
function onListContainterSuccess(file_list) {
api.getFile(container, file_name, {
token: token,
onSuccess: onDownloadFileSuccess,
onFailure: function ()
});
}
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
- All
- Comments
- History
- Activity
- Transitions