denoflare r2
Manage Cloudflare R2 storage using the S3 compatibility API
Built using our R2 TypeScript API
Each subcommand makes R2 calls via our R2 TypeScript API , available as a reusable module or individual functions for your own projects. The API is lightweight (no deps on aws-sdk or aws4fetch, only on fast-xml-parser and web standards). It can even be used within workers themselves.
--help
$ denoflare r2 --help
denoflare-r2 0.6.0
Manage Cloudflare R2 storage using the S3 compatibility API
USAGE:
denoflare r2 <subcommand> <args> <options>
SUBCOMMANDS:
list-buckets List all R2 buckets
head-bucket Determine if an R2 bucket exists
create-bucket Create a new R2 bucket
delete-bucket Delete an R2 bucket
get-bucket-encryption Gets encryption config for a bucket
delete-bucket-encryption Reset encryption config for a bucket
put-bucket-encryption Sets encryption config for a bucket
get-bucket-location Returns the region the bucket resides in
list-objects List objects within an R2 bucket (list-objects-v2)
list-objects-v1 List objects within a bucket (deprecated v1 version)
get-object Get R2 object for a given key
head-object Get R2 object (metadata only) for a given key
put-object Put R2 object for a given key
delete-object Delete R2 object for a given key
delete-objects Delete R2 objects for the given keys
copy-object Copy R2 object from a given source bucket and key
create-multipart-upload Start a multipart upload and return an upload ID
abort-multipart-upload Abort an existing multipart upload
complete-multipart-upload Complete an existing multipart upload
upload-part Upload part of a multipart upload
upload-part-copy Copy R2 part from a given source bucket and key
list-multipart-uploads List in-progress multipart uploads within an R2 bucket
generate-credentials Generate private R2-looking credentials for any use
presign Generate a presigned url for time-limited public access to a private R2 object
For subcommand-specific help: denoflare r2 <subcommand> --help
Bucket operations
list-buckets
$ denoflare r2 list-buckets --help
denoflare-r2-list-buckets 0.6.0
List all R2 buckets
USAGE:
denoflare r2 list-buckets [OPTIONS]
OPTIONS:
--unsigned-payload If set, skip request body signing (and thus verification) for the R2 request
--config <path> Path to config file (default: .denoflare in cwd or parents)
--profile <name> Explicit profile to use from config file
--account-id <string> Explicit Cloudflare account id to use for authentication
--api-token <string> Explicit Cloudflare API token to use for authentication
--help Print help information
--verbose Toggle verbose output (when applicable)
head-bucket
$ denoflare r2 head-bucket --help
denoflare-r2-head-bucket 0.6.0
Determine if an R2 bucket exists
USAGE:
denoflare r2 head-bucket <bucket> [OPTIONS]
ARGS:
<bucket> Name of the R2 bucket
OPTIONS:
--unsigned-payload If set, skip request body signing (and thus verification) for the R2 request
--url-style <url-style> URL addressing method used in request (one of: path, vhost, default: vhost)
--config <path> Path to config file (default: .denoflare in cwd or parents)
--profile <name> Explicit profile to use from config file
--account-id <string> Explicit Cloudflare account id to use for authentication
--api-token <string> Explicit Cloudflare API token to use for authentication
--help Print help information
--verbose Toggle verbose output (when applicable)
create-bucket
$ denoflare r2 create-bucket --help
denoflare-r2-create-bucket 0.6.0
Create a new R2 bucket
USAGE:
denoflare r2 create-bucket <bucket> [OPTIONS]
ARGS:
<bucket> Name of the R2 bucket
OPTIONS:
--unsigned-payload If set, skip request body signing (and thus verification) for the R2 request
--url-style <url-style> URL addressing method used in request (one of: path, vhost, default: vhost)
--config <path> Path to config file (default: .denoflare in cwd or parents)
--profile <name> Explicit profile to use from config file
--account-id <string> Explicit Cloudflare account id to use for authentication
--api-token <string> Explicit Cloudflare API token to use for authentication
--help Print help information
--verbose Toggle verbose output (when applicable)
delete-bucket
$ denoflare r2 delete-bucket --help
denoflare-r2-delete-bucket 0.6.0
Delete an R2 bucket
USAGE:
denoflare r2 delete-bucket <bucket> [OPTIONS]
ARGS:
<bucket> Name of the R2 bucket
OPTIONS:
--unsigned-payload If set, skip request body signing (and thus verification) for the R2 request
--url-style <url-style> URL addressing method used in request (one of: path, vhost, default: vhost)
--config <path> Path to config file (default: .denoflare in cwd or parents)
--profile <name> Explicit profile to use from config file
--account-id <string> Explicit Cloudflare account id to use for authentication
--api-token <string> Explicit Cloudflare API token to use for authentication
--help Print help information
--verbose Toggle verbose output (when applicable)
get-bucket-encryption
$ denoflare r2 get-bucket-encryption --help
denoflare-r2-get-bucket-encryption 0.6.0
Gets encryption config for a bucket
USAGE:
denoflare r2 get-bucket-encryption <bucket> [OPTIONS]
ARGS:
<bucket> Name of the R2 bucket
OPTIONS:
--unsigned-payload If set, skip request body signing (and thus verification) for the R2 request
--url-style <url-style> URL addressing method used in request (one of: path, vhost, default: vhost)
--config <path> Path to config file (default: .denoflare in cwd or parents)
--profile <name> Explicit profile to use from config file
--account-id <string> Explicit Cloudflare account id to use for authentication
--api-token <string> Explicit Cloudflare API token to use for authentication
--help Print help information
--verbose Toggle verbose output (when applicable)
delete-bucket-encryption
$ denoflare r2 delete-bucket-encryption --help
denoflare-r2-delete-bucket-encryption 0.6.0
Reset encryption config for a bucket
USAGE:
denoflare r2 delete-bucket-encryption <bucket> [OPTIONS]
ARGS:
<bucket> Name of the R2 bucket
OPTIONS:
--unsigned-payload If set, skip request body signing (and thus verification) for the R2 request
--url-style <url-style> URL addressing method used in request (one of: path, vhost, default: vhost)
--config <path> Path to config file (default: .denoflare in cwd or parents)
--profile <name> Explicit profile to use from config file
--account-id <string> Explicit Cloudflare account id to use for authentication
--api-token <string> Explicit Cloudflare API token to use for authentication
--help Print help information
--verbose Toggle verbose output (when applicable)
put-bucket-encryption
$ denoflare r2 put-bucket-encryption --help
denoflare-r2-put-bucket-encryption 0.6.0
Sets encryption config for a bucket
USAGE:
denoflare r2 put-bucket-encryption <bucket> [OPTIONS]
ARGS:
<bucket> Name of the R2 bucket
OPTIONS:
--unsigned-payload If set, skip request body signing (and thus verification) for the R2 request
--url-style <url-style> URL addressing method used in request (one of: path, vhost, default: vhost)
--config <path> Path to config file (default: .denoflare in cwd or parents)
--profile <name> Explicit profile to use from config file
--account-id <string> Explicit Cloudflare account id to use for authentication
--api-token <string> Explicit Cloudflare API token to use for authentication
--help Print help information
--verbose Toggle verbose output (when applicable)
get-bucket-location
$ denoflare r2 get-bucket-location --help
denoflare-r2-get-bucket-location 0.6.0
Returns the region the bucket resides in
USAGE:
denoflare r2 get-bucket-location <bucket> [OPTIONS]
ARGS:
<bucket> Name of the R2 bucket
OPTIONS:
--unsigned-payload If set, skip request body signing (and thus verification) for the R2 request
--url-style <url-style> URL addressing method used in request (one of: path, vhost, default: vhost)
--config <path> Path to config file (default: .denoflare in cwd or parents)
--profile <name> Explicit profile to use from config file
--account-id <string> Explicit Cloudflare account id to use for authentication
--api-token <string> Explicit Cloudflare API token to use for authentication
--help Print help information
--verbose Toggle verbose output (when applicable)
Object operations
list-objects
$ denoflare r2 list-objects --help
denoflare-r2-list-objects 0.6.0
List objects within an R2 bucket (list-objects-v2)
USAGE:
denoflare r2 list-objects <bucket> [OPTIONS]
ARGS:
<bucket> Name of the R2 bucket
OPTIONS:
--max-keys <integer> Limit the number of keys to return (min: 0, max: 1000)
--continuation-token <string> Continue the listing on this bucket with a previously returned token (token is obfuscated and is not a real key)
--start-after <key> Start listing after this specified key, can be any key in the bucket
--prefix <string> Limit to keys that begin with the specified prefix
--delimiter <char> The character used to group keys
--encoding-type <encoding-type> Encoding used to encode keys in the response (one of: url)
--fetch-owner If set, return the owner info for each item
--unsigned-payload If set, skip request body signing (and thus verification) for the R2 request
--url-style <url-style> URL addressing method used in request (one of: path, vhost, default: vhost)
--config <path> Path to config file (default: .denoflare in cwd or parents)
--profile <name> Explicit profile to use from config file
--account-id <string> Explicit Cloudflare account id to use for authentication
--api-token <string> Explicit Cloudflare API token to use for authentication
--help Print help information
--verbose Toggle verbose output (when applicable)
list-objects-v1
$ denoflare r2 list-objects-v1 --help
denoflare-r2-list-objects-v1 0.6.0
List objects within a bucket (deprecated v1 version)
USAGE:
denoflare r2 list-objects-v1 <bucket> [OPTIONS]
ARGS:
<bucket> Name of the R2 bucket
OPTIONS:
--max-keys <integer> Limit the number of keys to return (min: 0, max: 1000)
--marker <string> Start listing after this specified key, can be any key in the bucket
--prefix <string> Limit to keys that begin with the specified prefix
--delimiter <char> The character used to group keys
--encoding-type <encoding-type> Encoding used to encode keys in the response (one of: url)
--unsigned-payload If set, skip request body signing (and thus verification) for the R2 request
--url-style <url-style> URL addressing method used in request (one of: path, vhost, default: vhost)
--config <path> Path to config file (default: .denoflare in cwd or parents)
--profile <name> Explicit profile to use from config file
--account-id <string> Explicit Cloudflare account id to use for authentication
--api-token <string> Explicit Cloudflare API token to use for authentication
--help Print help information
--verbose Toggle verbose output (when applicable)
get-object
$ denoflare r2 get-object --help
denoflare-r2-get-object 0.6.0
Get R2 object for a given key
USAGE:
denoflare r2 get-object <bucket> <key> [OPTIONS]
ARGS:
<bucket> Name of the R2 bucket
<key> Key of the object to get
OPTIONS:
--if-match <string> Return the object only if its entity tag (ETag) is the same as the one specified
--if-none-match <string> Return the object only if its entity tag (ETag) is different from the one specified
--if-modified-since <string> Return the object only if it has been modified since the specified time
--if-unmodified-since <string> Return the object only if it has not been modified since the specified time
--range <string> Downloads the specified range bytes of an object, e.g. bytes=0-100
--part-number <integer> Part number of the object being read, effectively performs a ranged GET request for the part specified (min: 1, max: 10000)
--file <path> If specified, save object body to a local file
--unsigned-payload If set, skip request body signing (and thus verification) for the R2 request
--url-style <url-style> URL addressing method used in request (one of: path, vhost, default: vhost)
--config <path> Path to config file (default: .denoflare in cwd or parents)
--profile <name> Explicit profile to use from config file
--account-id <string> Explicit Cloudflare account id to use for authentication
--api-token <string> Explicit Cloudflare API token to use for authentication
--help Print help information
--verbose Toggle verbose output (when applicable)
head-object
$ denoflare r2 head-object --help
denoflare-r2-head-object 0.6.0
Get R2 object (metadata only) for a given key
USAGE:
denoflare r2 head-object <bucket> <key> [OPTIONS]
ARGS:
<bucket> Name of the R2 bucket
<key> Key of the object to get
OPTIONS:
--if-match <string> Return the object only if its entity tag (ETag) is the same as the one specified
--if-none-match <string> Return the object only if its entity tag (ETag) is different from the one specified
--if-modified-since <string> Return the object only if it has been modified since the specified time
--if-unmodified-since <string> Return the object only if it has not been modified since the specified time
--range <string> Downloads the specified range bytes of an object, e.g. bytes=0-100
--part-number <integer> Part number of the object being read, effectively performs a ranged GET request for the part specified (min: 1, max: 10000)
--unsigned-payload If set, skip request body signing (and thus verification) for the R2 request
--url-style <url-style> URL addressing method used in request (one of: path, vhost, default: vhost)
--config <path> Path to config file (default: .denoflare in cwd or parents)
--profile <name> Explicit profile to use from config file
--account-id <string> Explicit Cloudflare account id to use for authentication
--api-token <string> Explicit Cloudflare API token to use for authentication
--help Print help information
--verbose Toggle verbose output (when applicable)
put-object
$ denoflare r2 put-object --help
denoflare-r2-put-object 0.6.0
Put R2 object for a given key
USAGE:
denoflare r2 put-object <bucket> <key> [OPTIONS]
ARGS:
<bucket> Name of the R2 bucket
<key> Key of the object to put
OPTIONS:
--cache-control <string> Specify caching behavior along the request/reply chain
--content-disposition <string> Specify presentational information for the object
--content-encoding <string> Specify what content encodings have been applied to the object
--content-language <string> Specify the language the object is in
--content-type <string> A standard MIME type describing the format of the contents
--expires <string> The date and time at which the object is no longer cacheable
--custom <name=value>... Custom metadata for the object
--if-match <string> Put the object only if its entity tag (ETag) is the same as the one specified
--if-none-match <string> Put the object only if its entity tag (ETag) is different from the one specified
--if-modified-since <string> Put the object only if it has been modified since the specified time
--if-unmodified-since <string> Put the object only if it has not been modified since the specified time
--content-md5 <base64> Precomputed Content-MD5 of the contents
--compute-content-md5 If set, automatically compute Content-MD5 of the contents
--file <path> Path to the contents
--filestream <path> Path to the contents (streaming upload)
--bytes <string> Range of local file to upload (e.g. bytes=0-100)
--unsigned-payload If set, skip request body signing (and thus verification) for the R2 request
--url-style <url-style> URL addressing method used in request (one of: path, vhost, default: vhost)
--config <path> Path to config file (default: .denoflare in cwd or parents)
--profile <name> Explicit profile to use from config file
--account-id <string> Explicit Cloudflare account id to use for authentication
--api-token <string> Explicit Cloudflare API token to use for authentication
--help Print help information
--verbose Toggle verbose output (when applicable)
delete-object
$ denoflare r2 delete-object --help
denoflare-r2-delete-object 0.6.0
Delete R2 object for a given key
USAGE:
denoflare r2 delete-object <bucket> <key> [OPTIONS]
ARGS:
<bucket> Name of the R2 bucket
<key> Key of the object to delete
OPTIONS:
--version-id <string> Returns the version ID of the delete marker created as a result of the DELETE operation
--unsigned-payload If set, skip request body signing (and thus verification) for the R2 request
--url-style <url-style> URL addressing method used in request (one of: path, vhost, default: vhost)
--config <path> Path to config file (default: .denoflare in cwd or parents)
--profile <name> Explicit profile to use from config file
--account-id <string> Explicit Cloudflare account id to use for authentication
--api-token <string> Explicit Cloudflare API token to use for authentication
--help Print help information
--verbose Toggle verbose output (when applicable)
delete-objects
$ denoflare r2 delete-objects --help
denoflare-r2-delete-objects 0.6.0
Delete R2 objects for the given keys
USAGE:
denoflare r2 delete-objects <bucket> <key> <key>... [OPTIONS]
ARGS:
<bucket> Name of the R2 bucket
<key> Keys of the objects to delete
OPTIONS:
--quiet Enable quiet mode, response will only include keys where the delete action encountered an error
--unsigned-payload If set, skip request body signing (and thus verification) for the R2 request
--url-style <url-style> URL addressing method used in request (one of: path, vhost, default: vhost)
--config <path> Path to config file (default: .denoflare in cwd or parents)
--profile <name> Explicit profile to use from config file
--account-id <string> Explicit Cloudflare account id to use for authentication
--api-token <string> Explicit Cloudflare API token to use for authentication
--help Print help information
--verbose Toggle verbose output (when applicable)
copy-object
$ denoflare r2 copy-object --help
denoflare-r2-copy-object 0.6.0
Copy R2 object from a given source bucket and key
USAGE:
denoflare r2 copy-object <bucket> <key> [OPTIONS]
ARGS:
<bucket> Name of the destination R2 bucket
<key> Key of the destination object
OPTIONS:
--source-bucket <string> R2 Bucket of the source object (default: destination bucket)
--source-key <string> Key of the source object (required)
--cache-control <string> Specify caching behavior along the request/reply chain
--content-disposition <string> Specify presentational information for the object
--content-encoding <string> Specify what content encodings have been applied to the object
--content-language <string> Specify the language the object is in
--content-type <string> A standard MIME type describing the format of the contents
--expires <string> The date and time at which the object is no longer cacheable
--custom <name=value>... Custom metadata for the object
--if-match <string> Copies the object if its entity tag (ETag) matches the specified tag
--if-none-match <string> Copies the object if its entity tag (ETag) is different than the specified ETag
--if-modified-since <string> Copies the object if it has been modified since the specified time
--if-unmodified-since <string> Copies the object if it hasn't been modified since the specified time
--unsigned-payload If set, skip request body signing (and thus verification) for the R2 request
--url-style <url-style> URL addressing method used in request (one of: path, vhost, default: vhost)
--config <path> Path to config file (default: .denoflare in cwd or parents)
--profile <name> Explicit profile to use from config file
--account-id <string> Explicit Cloudflare account id to use for authentication
--api-token <string> Explicit Cloudflare API token to use for authentication
--help Print help information
--verbose Toggle verbose output (when applicable)
Multipart upload operations
create-multipart-upload
$ denoflare r2 create-multipart-upload --help
denoflare-r2-create-multipart-upload 0.6.0
Start a multipart upload and return an upload ID
USAGE:
denoflare r2 create-multipart-upload <bucket> <key> [OPTIONS]
ARGS:
<bucket> Name of the R2 bucket
<key> Key of the object to upload
OPTIONS:
--cache-control <string> Specify caching behavior along the request/reply chain
--content-disposition <string> Specify presentational information for the object
--content-encoding <string> Specify what content encodings have been applied to the object
--content-language <string> Specify the language the object is in
--content-type <string> A standard MIME type describing the format of the contents
--expires <string> The date and time at which the object is no longer cacheable
--custom <name=value>... Custom metadata for the object
--if-match <string> Put the object only if its entity tag (ETag) is the same as the one specified
--if-none-match <string> Put the object only if its entity tag (ETag) is different from the one specified
--if-modified-since <string> Put the object only if it has been modified since the specified time
--if-unmodified-since <string> Put the object only if it has not been modified since the specified time
--unsigned-payload If set, skip request body signing (and thus verification) for the R2 request
--url-style <url-style> URL addressing method used in request (one of: path, vhost, default: vhost)
--config <path> Path to config file (default: .denoflare in cwd or parents)
--profile <name> Explicit profile to use from config file
--account-id <string> Explicit Cloudflare account id to use for authentication
--api-token <string> Explicit Cloudflare API token to use for authentication
--help Print help information
--verbose Toggle verbose output (when applicable)
abort-multipart-upload
$ denoflare r2 abort-multipart-upload --help
denoflare-r2-abort-multipart-upload 0.6.0
Abort an existing multipart upload
USAGE:
denoflare r2 abort-multipart-upload <bucket> <key> <upload-id> [OPTIONS]
ARGS:
<bucket> Name of the R2 bucket
<key> Key of the object
<upload-id> Id of the existing multipart upload to abort
OPTIONS:
--unsigned-payload If set, skip request body signing (and thus verification) for the R2 request
--url-style <url-style> URL addressing method used in request (one of: path, vhost, default: vhost)
--config <path> Path to config file (default: .denoflare in cwd or parents)
--profile <name> Explicit profile to use from config file
--account-id <string> Explicit Cloudflare account id to use for authentication
--api-token <string> Explicit Cloudflare API token to use for authentication
--help Print help information
--verbose Toggle verbose output (when applicable)
complete-multipart-upload
$ denoflare r2 complete-multipart-upload --help
denoflare-r2-complete-multipart-upload 0.6.0
Complete an existing multipart upload
USAGE:
denoflare r2 complete-multipart-upload <bucket> <key> <upload-id> <part> <part>... [OPTIONS]
ARGS:
<bucket> Name of the R2 bucket
<key> Key of the object
<upload-id> Id of the existing multipart upload to complete
<part> partNumber:etag
OPTIONS:
--unsigned-payload If set, skip request body signing (and thus verification) for the R2 request
--url-style <url-style> URL addressing method used in request (one of: path, vhost, default: vhost)
--config <path> Path to config file (default: .denoflare in cwd or parents)
--profile <name> Explicit profile to use from config file
--account-id <string> Explicit Cloudflare account id to use for authentication
--api-token <string> Explicit Cloudflare API token to use for authentication
--help Print help information
--verbose Toggle verbose output (when applicable)
upload-part
$ denoflare r2 upload-part --help
denoflare-r2-upload-part 0.6.0
Upload part of a multipart upload
USAGE:
denoflare r2 upload-part <bucket> <key> [OPTIONS]
ARGS:
<bucket> Name of the R2 bucket
<key> Key of the object
OPTIONS:
--upload-id <string> Id of the existing multipart upload to complete (required)
--part-number <integer> Number of the part (required)
--content-md5 <base64> Precomputed Content-MD5 of the contents
--compute-content-md5 If set, automatically compute Content-MD5 of the contents
--file <path> Path to the contents
--filestream <path> Path to the contents (streaming upload)
--bytes <string> Range of local file to upload (e.g. bytes=0-100)
--unsigned-payload If set, skip request body signing (and thus verification) for the R2 request
--url-style <url-style> URL addressing method used in request (one of: path, vhost, default: vhost)
--config <path> Path to config file (default: .denoflare in cwd or parents)
--profile <name> Explicit profile to use from config file
--account-id <string> Explicit Cloudflare account id to use for authentication
--api-token <string> Explicit Cloudflare API token to use for authentication
--help Print help information
--verbose Toggle verbose output (when applicable)
upload-part-copy
$ denoflare r2 upload-part-copy --help
denoflare-r2-upload-part-copy 0.6.0
Copy R2 part from a given source bucket and key
USAGE:
denoflare r2 upload-part-copy <bucket> <key> [OPTIONS]
ARGS:
<bucket> Name of the R2 bucket
<key> Key of the object
OPTIONS:
--upload-id <string> Id of the existing multipart upload to complete (required)
--part-number <integer> Number of the part (required)
--source-bucket <string> R2 Bucket of the source object (default: destination bucket)
--source-key <string> Key of the source object (required)
--source-range <string> The range of bytes to copy from the source object
--if-match <string> Copies the object part if its entity tag (ETag) matches the specified tag
--if-none-match <string> Copies the object part if its entity tag (ETag) is different than the specified ETag
--if-modified-since <string> Copies the object part if it has been modified since the specified time
--if-unmodified-since <string> Copies the object part if it hasn't been modified since the specified time
--unsigned-payload If set, skip request body signing (and thus verification) for the R2 request
--url-style <url-style> URL addressing method used in request (one of: path, vhost, default: vhost)
--config <path> Path to config file (default: .denoflare in cwd or parents)
--profile <name> Explicit profile to use from config file
--account-id <string> Explicit Cloudflare account id to use for authentication
--api-token <string> Explicit Cloudflare API token to use for authentication
--help Print help information
--verbose Toggle verbose output (when applicable)
list-multipart-uploads
$ denoflare r2 list-multipart-uploads --help
denoflare-r2-list-multipart-uploads 0.6.0
List in-progress multipart uploads within an R2 bucket
USAGE:
denoflare r2 list-multipart-uploads <bucket> [OPTIONS]
ARGS:
<bucket> Name of the R2 bucket
OPTIONS:
--delimiter <char> The character used to group keys
--encoding-type <encoding-type> Encoding used to encode keys in the response (one of: url)
--key-marker <string> Together with upload-id-marker, specifies the multipart upload after which listing should begin
--max-uploads <integer> Limit the number of multipart uploads to return (min: 0, max: 1000)
--prefix <string> Limit to uploads for keys that begin with the specified prefix
--upload-id-marker <string> Together with key-marker, specifies the upload after which listing should begin
--unsigned-payload If set, skip request body signing (and thus verification) for the R2 request
--url-style <url-style> URL addressing method used in request (one of: path, vhost, default: vhost)
--config <path> Path to config file (default: .denoflare in cwd or parents)
--profile <name> Explicit profile to use from config file
--account-id <string> Explicit Cloudflare account id to use for authentication
--api-token <string> Explicit Cloudflare API token to use for authentication
--help Print help information
--verbose Toggle verbose output (when applicable)
Other
generate-credentials
$ denoflare r2 generate-credentials --help
denoflare-r2-generate-credentials 0.6.0
Generate private R2-looking credentials for any use
USAGE:
denoflare r2 generate-credentials [OPTIONS]
OPTIONS:
--help Print help information
--verbose Toggle verbose output (when applicable)
presign
$ denoflare r2 presign --help
denoflare-r2-presign 0.6.0
Generate a presigned url for time-limited public access to a private R2 object
USAGE:
denoflare r2 presign <bucket> <key> [OPTIONS]
ARGS:
<bucket> Name of the R2 bucket
<key> Key of the object
OPTIONS:
--expires-in <integer> Number of seconds until the presigned url expires (default: 3600 (one hour), maximum: 604800 (one week))
--endpoint-origin <origin> Custom origin to use for vhost-style requests (e.g. https://mydomain.com), signed url will use the bucketname as a subdomain (e.g. https://mybucket.mydomain.com)
--access-key <string> Custom access-key to use when using a custom --endpoint-origin
--secret-key <string> Custom secret-key to use when using a custom --endpoint-origin
--url-style <url-style> URL addressing method used in request (one of: path, vhost, default: vhost)
--config <path> Path to config file (default: .denoflare in cwd or parents)
--profile <name> Explicit profile to use from config file
--account-id <string> Explicit Cloudflare account id to use for authentication
--api-token <string> Explicit Cloudflare API token to use for authentication
--help Print help information
--verbose Toggle verbose output (when applicable)
Generate a presigned url for an item with the key path/to/my-file.txt
in the bucket my-bucket
using the default expiration of 3600 seconds (1 hour) and the default vhost url-style (bucket name as subdomain)
$ denoflare r2 presign my-bucket path/to/my-file.txt
https://my-bucket.90c02c3ba7ea43d49f37fd9a42dba752.r2.cloudflarestorage.com/path/to/my-file.txt?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=90c02c3ba7ea43d49f37fd9a42dba752%2F20220709%2Fauto%2Fs3%2Faws4_request&X-Amz-Date=20220709T173312Z&X-Amz-Expires=3600&X-Amz-SignedHeaders=host&X-Amz-Signature=00d782217aef447598a8e6d2298988b220d4a76c5c3a4954af4bf0cc1b69b244
Generate a presigned url that expires in 10 seconds and uses the older path-based url-style (bucket name as the first path element)
$ denoflare r2 presign my-bucket path/to/my-file.txt --url-style path --expires-in 10
https://90c02c3ba7ea43d49f37fd9a42dba752.r2.cloudflarestorage.com/my-bucket/path/to/my-file.txt?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=90c02c3ba7ea43d49f37fd9a42dba752%2F20220709%2Fauto%2Fs3%2Faws4_request&X-Amz-Date=20220709T174244Z&X-Amz-Expires=10&X-Amz-SignedHeaders=host&X-Amz-Signature=a0b80365764242189cc08258681bb24aa0b80365764242189cc08258681bb24a