function download_file(path, mimetype) { let file = path.split('/'); let filename = file[file.length - 1]; httpGetAsync(base_url + path, null, function (response, code) { if (code === 200) { let element = document.createElement('a'); element.setAttribute('href', 'data:' + mimetype + ',' + encodeURIComponent(response)); element.setAttribute('download', filename); element.style.display = 'none'; document.body.appendChild(element); element.click(); document.body.removeChild(element); } else { try_to_parse_error(response); } }); } function remove_file(filename) { httpDeleteAsync(base_url + filename, null, function (response, code) { if (code === 200) { create_success_view("Successfully deleted."); path_changed(); } else { try_to_parse_error(response); } }); }