cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Want to learn some quick and useful tips to make your day easier? Check out how Calvin uses Replay to get feedback from other teams at Dropbox here.

Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Re: download blob using dropbox Saver

download blob using dropbox Saver

joost2076
Explorer | Level 3
Go to solution

Hi,

I am trying to use the dropbox Saver (https://www.dropbox.com/developers/saver) to download a json blob from my desktop (ubuntu).

 

This leads to an error:  Url "blob:http://localhost:5000/f58ddb0b-48ed-46ab-87b3-f45a1ee8a7df" uses unsupported scheme

 

Is it possible to download a blob using Saver ? If so, any ideas what I am doing wrong? 

The code i used is as follows: with url = blob:http://localhost:5000/f58ddb0b-48ed-46ab-87b3-f45a1ee8a7df", and filename = "yourmap.json"

 

Thanks, 

Joost

 

function create_dropbox_save_button(url, mapname){
    var options = {  
        success: function () {
            // Indicate to the user that the files have been saved.
            alert("Success! Files saved to your Dropbox.");
        },
        progress: function (progress) {console.log(progress)},
        cancel: function () {},
        error: function (errorMessage) {console.log(errorMessage)}
    };
    var button = Dropbox.createSaveButton(url, mapname, options);
    document.getElementById("dl_dropbox").appendChild(button);
}

 

1 Accepted Solution

Accepted Solutions

Greg-DB
Dropbox Staff
Go to solution
The Dropbox Saver doesn't support blobs, local files, or data URIs unfortunately, but I'll pass this along as a feature request.

View solution in original post

5 Replies 5

Greg-DB
Dropbox Staff
Go to solution
The Dropbox Saver doesn't support blobs, local files, or data URIs unfortunately, but I'll pass this along as a feature request.

blurymind
New member | Level 2
Go to solution

Hi, I need this too in order toimplement saving to db from https://yarnspinnertool.github.io/YarnEditor/

Is there an alternative approach to blobs? I want to write a simple string from my webapp to a dropbox folder - as a text file. Is that possible or not? If so how and why is your documentation lacking a simple example?

Greg-DB
Dropbox Staff
Go to solution

@blurymind No, the Dropbox Saver still doesn't support saving blobs, or some other local alternative. I'll add your vote to the feature request, but I can't promise if or when that might be implemented.

The Dropbox Saver only supports saving from Internet-accessible URLs. If you want to use the Saver to save a text file, you'll need to supply the data via an Internet-accessible URL.

Alternatively, you can use the Dropbox API, e.g., via the official Dropbox JavaScript SDK, to upload directly to Dropbox from the browser, but that would be more work and would require you to have the user explicitly authorize the app via the OAuth app authorization flow. 

blurymind
New member | Level 2
Go to solution

 

I was able to achieve creating and saving a new text file by doing this and passing it as an url to the saver: 

https://github.com/YarnSpinnerTool/YarnEditor/blob/master/src/js/classes/utils.js#L278

however there is a catch. Both the saver and the chooser only function when running from the web app hosted here:

https://yarnspinnertool.github.io/YarnEditor/

Perhaps more annoyingly, the saver can not overwrite files when asked to.

Dropbox denies them both access if running from a localhost server or a hosted file. This is why I disabled it for the electron version of yarnEditor.

Wish I could use one codebase that is simple and effective to achieve saving and loading - but the current  api doesn't seem to have an easy answer to thi

 

 

Greg-DB
Dropbox Staff
Go to solution

@blurymind Thanks for sharing this! Please note though that the Saver only officially supports HTTP and HTTPS URIs, so while data URIs like this may happen to work, I don't recommend relying on that. It may not work consistently, or may break without notice.

Also, yes, the Chooser and Saver do need to run on a hosted page where they can verify the domain against the pre-registered Chooser/Saver domains for the app key being used.

The Saver also doesn't currently support overwrite or other write modes, but I'll pass these along as feature request as well.

Need more support?