Download file from internal storage
1 min
code examples curl request get \\ \ url '/api/storage/read?path=%2fext%2ftest png' \\ \ header 'accept application/octet stream'var myheaders = new headers(); myheaders append("accept", "application/octet stream"); myheaders append("content type", "application/json"); var requestoptions = { method 'get', headers myheaders, redirect 'follow' }; fetch("/api/storage/read?path=/ext/test png", requestoptions) then(response => response text()) then(result => console log(result)) catch(error => console log('error', error));require "uri" require "json" require "net/http" url = uri("/api/storage/read?path=/ext/test png") http = net http new(url host, url port); request = net http get new(url) request\["accept"] = "application/octet stream" request\["content type"] = "application/json" response = http request(request) puts response read body import requests import json url = "/api/storage/read?path=/ext/test png" payload = {} headers = { 'accept' 'application/octet stream', 'content type' 'application/json' } response = requests request("get", url, headers=headers, data=payload) print(response text) responses // file downloaded successfully // invalid parameters or file not exists { "error" "", "code" 0 }
