[ https://jira.fiware.org/browse/HELP-13407?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Fernando Lopez deleted HELP-13407:
----------------------------------
> [fiware-stackoverflow] Download blob from fiware object-storage
> ---------------------------------------------------------------
>
> Key: HELP-13407
> URL: https://jira.fiware.org/browse/HELP-13407
> Project: Help-Desk
> Issue Type: Monitor
> Reporter: Backlog Manager
> Labels: fiware, fiware-wirecloud
>
> Created question in FIWARE Q/A platform on 26-06-2014 at 18:06
> {color: red}Please, ANSWER this question AT{color} https://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?
--
This message was sent by Atlassian JIRA
(v6.4.1#64016)
You can get more information about our cookies and privacy policies clicking on the following links: Privacy policy Cookies policy