How to download file with file api?

In js sample,there is nothing to show about how to download file.
I put a file (.apk) to file storage,

$(document).on("api:files:ready", function () {
    console.log("api:files:ready",body);
    dreamfactory.files.getFile({"container": "downloads", file_path: 'bak.apk',download:true})
        .then(function (response) {

// console.log(“success”,response.responseText);
console.log(“success”,response);
},
function (error) {
console.error(“fail”,error.responseText);

        });
});

I just want download! (response file),but I find there is only three type(son,xml,text)could be set to content type.

return $.ajax({
url: BASE_PATH + newPath,
beforeSend: function (request) {
request.setRequestHeader(“X-DREAMFACTORY-APPLICATION-NAME”, APP_NAME);
request.setRequestHeader(“X-DREAMFACTORY-SESSION-TOKEN”, sessionStorage.SESSION_TOKEN);
request.setRequestHeader(“Content-Type”, “application/vnd.android.package-archive”);
request.setRequestHeader(“Accept”, “application/vnd.android.package-archive”);
},
method: method.method,
contentType: “application/vnd.android.package-archive; charset=utf-8”,
dataType: “apk”,
processData: processData,
data: newdata,
cache: false
});

this code seems not work.could provide a demo about how to use file.thanks

I know this is odd, but if you look at the source code for some of the helper libraries, they basically just do :smile:

window.location = path/to/file

The browser won’t go anywhere, it’ll just prompt for download.

If you find a new hip way to do that, let me know.

I used getFile api,then get base64 encoding content, so I decode it ,and use js to save file.
It’s bit not wise.Important there is no promote to download with browser!

window.location = path/to/file
could tell me path is full(http://baseurl+ /mycontains/myfold/myfile),or partial (e.g. /mycontains/myfold/myfile)?
and how could I get path,if it need responsed from request or as I know while uploaded,just fill it

Here’s the file that drives the current file manager, you’ll see we use the full url.

https://github.com/dreamfactorysoftware/dsp-core/blob/master/web/filemanager/js/filemanagement.js