Skip to main content

Interface: R2Options

Cloudflare R2 options. Credentials are required; define CF_R2_ACCESS_KEY_ID and CF_R2_SECRET_ACCESS_KEY environment variables with an R2 API token (see https://developers.cloudflare.com/r2/api/s3/tokens/).

Public access for auto-updates: R2 buckets are private by default. The S3-compatible API endpoint always requires authentication, so electron-updater cannot download updates directly from it. You must either enable a custom domain or an r2.dev subdomain for the bucket in the Cloudflare dashboard (see https://developers.cloudflare.com/r2/buckets/public-buckets/) and then set publicUrl to that base URL so the updater knows where to fetch update metadata and binaries.

ACLs: R2 does not support S3 ACLs. The acl option from BaseS3Options is intentionally excluded here. Configure public bucket access in the Cloudflare dashboard instead.

Example configuration:

{
"build": {
"publish": {
"provider": "r2",
"bucket": "my-releases",
"accountId": "abcdef1234567890abcdef1234567890",
"publicUrl": "https://pub-abcdef1234567890abcdef1234567890.r2.dev"
}
}
}

Extends​

Properties​

accountId​

readonly accountId: string

Your Cloudflare account ID (32-character hex string). Found on the R2 overview page in the Cloudflare dashboard. Used to construct the S3-compatible upload endpoint: https://<accountId>.r2.cloudflarestorage.com


acl?​

readonly optional acl?: undefined

R2 does not support S3 ACLs. This option is not applicable and will be ignored. Configure bucket-level public access in the Cloudflare dashboard instead.

Overrides​

BaseS3Options.acl


bucket​

readonly bucket: string

The R2 bucket name.


channel?​

optional channel?: string | null

The update channel.

Default​

latest

Inherited from​

BaseS3Options.channel


jurisdiction?​

readonly optional jurisdiction?: "eu" | "fedramp" | null

The jurisdiction of the R2 bucket, if the bucket was created with a jurisdictional restriction. Buckets created in a jurisdiction live on a separate endpoint — https://<accountId>.<jurisdiction>.r2.cloudflarestorage.com — so this must match the jurisdiction the bucket was created with. Omit for regular buckets.

See https://developers.cloudflare.com/r2/reference/data-location/#jurisdictional-restrictions


path?​

readonly optional path?: string | null

The directory path.

Default​

/

Inherited from​

BaseS3Options.path


provider​

readonly provider: "r2"

The provider. Must be r2.

Overrides​

BaseS3Options.provider


publicUrl?​

readonly optional publicUrl?: string | null

The public base URL from which electron-updater will download update metadata and binaries. This must be the URL of your bucket's custom domain or r2.dev subdomain (e.g. https://pub-xxx.r2.dev or https://cdn.example.com).

Required when publishAutoUpdate is not false. The R2 S3 API endpoint requires authentication and cannot serve unauthenticated download requests.

See https://developers.cloudflare.com/r2/buckets/public-buckets/


publishAutoUpdate?​

readonly optional publishAutoUpdate?: boolean

Whether to publish auto update info files.

Auto update relies only on the first provider in the list (you can specify several publishers). Thus, probably, theres no need to upload the metadata files for the other configured providers. But by default will be uploaded. A provider with falsenever becomes the feed embedded inapp-update.yml` while a later provider receives the metadata: the first provider that does is embedded instead.

Default​

true

Inherited from​

BaseS3Options.publishAutoUpdate


requestHeaders?​

readonly optional requestHeaders?: OutgoingHttpHeaders

Any custom request headers

Inherited from​

BaseS3Options.requestHeaders


timeout?​

readonly optional timeout?: number | null

Request timeout in milliseconds. (Default is 2 minutes; O is ignored)

Default​

120000

Inherited from​

BaseS3Options.timeout