Download file or folder

api

The FileAPI.DownloadFile API enables a file to be downloaded from a resource on the tdx Volt to the local disk.

Both the fusebox and the cli make use of this endpoint to also support downloading folders or entire trees of files.

cli

Use the download cli command.

Terminal window
./volt download --help

Download a file or folder:

Terminal window
./volt download ./share/pictures ./shared-images

fusebox

Use the ‘download’ button on the folder toolbar.

fusebox-download

javascript

grpc

const response = await client.DownloadFileSync({
resource_id: "@download-demo",
});
console.log(Buffer.from(response.buffer, "base64").toString());

web

Use the DownloadFile API to stream the resource contents, writing each chunk received to memory or local disk.

let contents = "";
const rpc = voltApi.DownloadFile({ resource_id: resource.id });
rpc.on("error", (err) => {
console.log("Error downloading file: " + err.message);
});
rpc.on("data", (payload) => {
contents += atob(payload.block || "");
});
rpc.on("end", () => {
console.log("download finished");
console.log(contents);
});

C++

auto result = voltApi->downloadFileSync("@download-demo", "c:/temp/download-demo", cancelCB);