The upload module POSTs a local file's contents as a raw body to a
target URL and resolves with an UploadResult ({ status, ok, body },
body truncated to 512 characters). Backed by the single
plugin:upload|upload command (a simplified port of
tauri-plugin-upload: no multipart or progress callbacks yet). The
namespace export is uploader (the main entry also exports the bare
upload function).
Permission: upload:allow-upload, collected in the upload:default
set.
The scope is a required plugin construction option, checked on both
ends — file paths go through a PathScope and the target URL through an
HttpScope; violations are rejected by each respectively (the URL side
throws upload: url scope denied, the file side PathScope's
access denied: … is outside the configured scope). From
examples/hello/src/main.ts:
The matching capability entry is "upload:default".
From examples/hello/frontend/src/main.ts (the anchor UPLOAD_OK is its
real run output; uploads to the local echo server and verifies the round
trip, comments kept, excerpts elided):
Note the path argument is written as $TMP/... — scope variables are
resolved by the backend's PathScope, the same convention as the fs
module.
plugin:upload|* totals 1 command:
| Command | API |
|---|---|
upload |
upload(url, file) |
Full list in the Commands Reference and the API symbol reference.
Applicable version: ztron 0.3.1