/_bridge/transfers#The web app's transfers.
ITransfersBridge.GetTransfersAsyncTSTransfersBridge.getTransfers- Response
- 200 TransferList
TransferList · 1 field
transfersTransferInfo[]
Nothing matches that. Try a shorter word, or browse the topics.
The HTTP transfers bridge queues background uploads and downloads to and from the file roots. Progress arrives as events, and completion reaches the page or background.js. It’s backed by Shiny.Net.Http.
dotnet add package Shiny.AppDeviceBridge.HttpTransfersbuilder.UseAppDeviceBridge( bridge => bridge.AddHttpTransfersBridge(), webApp => { /* … */ });| Client | C# | TypeScript |
|---|---|---|
ITransfersBridge |
AddTransfersBridgeClient() |
TransfersBridge |
| Topic | Details |
|---|---|
| Queuing | POST /_bridge/transfers with a type (Download, UploadMultipart or UploadRaw), a url, and a file as root plus path, the same names /_bridge/files uses. Uploads can add method, headers, formDataName and a small multipart body. Downloads can pass "overwrite": false. |
| Downloads land whole | the file is written beside its destination under a hidden name and moved into place when it completes. The destination is checked again at that moment. |
| Limits | http and https only. Loopback URLs are refused unless you change AllowUrl. Connection, length and proxy headers are refused. At most MaxTransfers (32) are queued at once. |
| Ownership | the page only lists and cancels its own transfers. DELETE /_bridge/transfers leaves the native app’s transfers running. |
| Finishing in the background | transfer.completed and transfer.failed reach the page, or background.js when no page is open. Progress is an event only, at most every ProgressInterval (250 ms) per transfer. |
| Platform setup | Android needs FOREGROUND_SERVICE_DATA_SYNC. On iOS and Mac Catalyst, override HandleEventsForBackgroundUrl in the app delegate and pass it to Shiny.Hosting.Host.Lifecycle.OnHandleEventsForBackgroundUrl, or transfers that finish while the app is suspended wait for the next launch. macOS and Linux run transfers in-process only. |
Transfers run in the operating system’s background transfer service, so they keep going with the app closed. Downloads land in a file root; uploads read from one.
import { TransfersBridge } from "@shinyorg/appdevicebridge";
const transfers = new TransfersBridge();await transfers.onProgress(t => bar.value = t.percentComplete ?? 0);await transfers.onCompleted(t => console.log("saved to", t.root, t.path));await transfers.onFailed(t => console.warn(t.statusCode, t.error));
const t = await transfers.queue({ type: "Download", url: "https://example.com/big.zip", root: "data", path: "downloads/big.zip", overwrite: true});/_bridge/transfers#The web app's transfers.
ITransfersBridge.GetTransfersAsyncTSTransfersBridge.getTransferstransfers | TransferInfo[] |
/_bridge/transfers#Queues a transfer. Fails with 403 for a URL the app does not allow, 404 for an unknown root or a missing upload file, 409 when a download's destination exists and overwrite is off, 429 when too many are queued.
ITransfersBridge.QueueAsyncTSTransfersBridge.queueapplication/json · TransferRequesttype | TransferType | |
url | string | An absolute http or https URL. Loopback is refused unless the app allows it. |
root | string | The file root a download goes into or an upload comes from. |
path | string | The file inside the root. |
method | string | null | GET, POST, PUT or PATCH; the transfer type's default when null. |
headers | Record<string, string> | null | At most 32. Hop-by-hop, content and proxy headers are refused. |
useMeteredConnection | boolean | Whether the transfer may run on a metered network. |
formDataName | string | null | The file's form field name for a multipart upload; file when null. |
body | TransferBody | null | An extra form part, for a multipart upload only. |
overwrite | boolean | Whether a download may replace an existing file. |
id | string | |
type | TransferType | |
url | string | |
root | string | null | The file root, while the file is inside one. |
path | string | null | |
status | TransferState | |
bytesTransferred | number | |
bytesToTransfer | number | null | |
bytesPerSecond | number | null | |
percentComplete | number | null | 0–1, when the size is known. |
createdAt | string | null | |
statusCode | number | null | The server's status, for a failure that had one. |
error | string | null | Why it failed. |
/_bridge/transfers#Cancels every web app transfer, and none of the native app's.
ITransfersBridge.CancelAllAsyncTSTransfersBridge.cancelAll/_bridge/transfers/{id}#One transfer. Fails with 404 when there is no such transfer.
ITransfersBridge.GetTransferAsyncTSTransfersBridge.getTransfer| Parameter | In | Type | |
|---|---|---|---|
id | path | string | required |
id | string | |
type | TransferType | |
url | string | |
root | string | null | The file root, while the file is inside one. |
path | string | null | |
status | TransferState | |
bytesTransferred | number | |
bytesToTransfer | number | null | |
bytesPerSecond | number | null | |
percentComplete | number | null | 0–1, when the size is known. |
createdAt | string | null | |
statusCode | number | null | The server's status, for a failure that had one. |
error | string | null | Why it failed. |
/_bridge/transfers/{id}#Cancels a transfer.
ITransfersBridge.CancelAsyncTSTransfersBridge.cancel| Parameter | In | Type | |
|---|---|---|---|
id | path | string | required |
/_bridge/transfers/{id}/pause#Pauses a transfer.
ITransfersBridge.PauseAsyncTSTransfersBridge.pause| Parameter | In | Type | |
|---|---|---|---|
id | path | string | required |
/_bridge/transfers/{id}/resume#Resumes a paused transfer.
ITransfersBridge.ResumeAsyncTSTransfersBridge.resume| Parameter | In | Type | |
|---|---|---|---|
id | path | string | required |
transfer.progress#A transfer moved on or changed state. Throttled per transfer; a state change always comes through.
ITransfersBridge.OnProgressAsyncTSTransfersBridge.onProgressTransferInfoid | string | |
type | TransferType | |
url | string | |
root | string | null | The file root, while the file is inside one. |
path | string | null | |
status | TransferState | |
bytesTransferred | number | |
bytesToTransfer | number | null | |
bytesPerSecond | number | null | |
percentComplete | number | null | 0–1, when the size is known. |
createdAt | string | null | |
statusCode | number | null | The server's status, for a failure that had one. |
error | string | null | Why it failed. |
transfer.completed#A transfer completed; a download is in place at its path.
ITransfersBridge.OnCompletedAsyncTSTransfersBridge.onCompletedTransferInfoid | string | |
type | TransferType | |
url | string | |
root | string | null | The file root, while the file is inside one. |
path | string | null | |
status | TransferState | |
bytesTransferred | number | |
bytesToTransfer | number | null | |
bytesPerSecond | number | null | |
percentComplete | number | null | 0–1, when the size is known. |
createdAt | string | null | |
statusCode | number | null | The server's status, for a failure that had one. |
error | string | null | Why it failed. |
transfer.failed#A transfer failed.
ITransfersBridge.OnFailedAsyncTSTransfersBridge.onFailedTransferInfoid | string | |
type | TransferType | |
url | string | |
root | string | null | The file root, while the file is inside one. |
path | string | null | |
status | TransferState | |
bytesTransferred | number | |
bytesToTransfer | number | null | |
bytesPerSecond | number | null | |
percentComplete | number | null | 0–1, when the size is known. |
createdAt | string | null | |
statusCode | number | null | The server's status, for a failure that had one. |
error | string | null | Why it failed. |
transfer.cancelled#A transfer was cancelled.
ITransfersBridge.OnCancelledAsyncTSTransfersBridge.onCancelledTransferInfoid | string | |
type | TransferType | |
url | string | |
root | string | null | The file root, while the file is inside one. |
path | string | null | |
status | TransferState | |
bytesTransferred | number | |
bytesToTransfer | number | null | |
bytesPerSecond | number | null | |
percentComplete | number | null | 0–1, when the size is known. |
createdAt | string | null | |
statusCode | number | null | The server's status, for a failure that had one. |
error | string | null | Why it failed. |
JSON property names are camelCase and enums travel as their names. A ? marks a property the payload may omit;| null one that may be null.
TransferListobject#transfers | TransferInfo[] |
TransferInfoobject#A transfer.
id | string | |
type | TransferType | |
url | string | |
root | string | null | The file root, while the file is inside one. |
path | string | null | |
status | TransferState | |
bytesTransferred | number | |
bytesToTransfer | number | null | |
bytesPerSecond | number | null | |
percentComplete | number | null | 0–1, when the size is known. |
createdAt | string | null | |
statusCode | number | null | The server's status, for a failure that had one. |
error | string | null | Why it failed. |
TransferTypeenum#"UploadMultipart""UploadRaw""Download"TransferStateenum#"Unknown""Pending""Paused""PausedByNoNetwork""PausedByCostedNetwork""InProgress""Error""Canceled""Completed"TransferRequestobject#A transfer to queue.
type | TransferType | |
url | string | An absolute http or https URL. Loopback is refused unless the app allows it. |
root | string | The file root a download goes into or an upload comes from. |
path | string | The file inside the root. |
method? | string | null | GET, POST, PUT or PATCH; the transfer type's default when null. |
headers? | Record<string, string> | null | At most 32. Hop-by-hop, content and proxy headers are refused. |
useMeteredConnection? | boolean | Whether the transfer may run on a metered network. |
formDataName? | string | null | The file's form field name for a multipart upload; file when null. |
body? | TransferBody | null | An extra form part, for a multipart upload only. |
overwrite? | boolean | Whether a download may replace an existing file. |
TransferBodyobject#An extra form part sent with a multipart upload.
content | string | At most 1 MB. |
contentType? | string | null | text/plain when null. |
formDataName? | string | null |
These routes sit under AppDeviceBridgePolicies.Bridges like every other bridge: callers on this device by default.
See Security.