tcb storage objects upload
Upload a local file to a Storage bucket.
v3.4.0+
PG mode storage commands have been available since @cloudbase/cli@3.4.0.
Usage
tcb storage objects upload <localPath> <key> -b <bucketId> [options]
Parameters
| Parameter | Required | Description | Default |
|---|---|---|---|
<localPath> | Yes | Local file path, must be a file | — |
<key> | Yes | Remote object name, must not start with / | — |
-b, --bucket <bucketId> | Yes | Bucket ID, the TCB_BUCKET_ID environment variable also works | — |
--content-type <mime> | No | Explicit MIME type, inferred from the extension and magic bytes when omitted | Inferred |
--cache-control <value> | No | An integer becomes max-age=<n>, a string is written to Cache-Control as is | — |
--metadata <json> | No | Custom metadata JSON, Base64 encoded into X-Metadata | — |
--robots-tag <value> | No | X-Robots-Tag header | — |
--upsert | No | Allow overwriting an existing object in POST mode | false |
--use-put | No | Use the PUT method, always overwrites | false |
--json | No | Output the raw SDK result { Id, Key } | — |
Examples
tcb storage objects upload ./hello.txt test/hello.txt -b my-bucket
tcb storage objects upload ./hello.txt test/hello.txt -b my-bucket --content-type text/plain --upsert
Related Commands
- Download an object
- Generate a signed URL: upload mode allows direct uploads
- List objects