Skip to main content

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​

ParameterRequiredDescriptionDefault
<localPath>YesLocal file path, must be a file—
<key>YesRemote object name, must not start with /—
-b, --bucket <bucketId>YesBucket ID, the TCB_BUCKET_ID environment variable also works—
--content-type <mime>NoExplicit MIME type, inferred from the extension and magic bytes when omittedInferred
--cache-control <value>NoAn integer becomes max-age=<n>, a string is written to Cache-Control as is—
--metadata <json>NoCustom metadata JSON, Base64 encoded into X-Metadata—
--robots-tag <value>NoX-Robots-Tag header—
--upsertNoAllow overwriting an existing object in POST modefalse
--use-putNoUse the PUT method, always overwritesfalse
--jsonNoOutput 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