Skip to main content

getOrCreateBucket()

在你的 S3 账户中为 Remotion Lambda 创建一个存储桶。如果已经存在,则会返回现有的存储桶。

🌐 Creates a bucket for Remotion Lambda in your S3 account. If one already exists, it will get returned instead.

每个区域只需要 1 个桶,Remotion Lambda 就能正常工作。

import {getOrCreateBucket} from '@remotion/lambda';

const {bucketName} = await getOrCreateBucket({region: 'us-east-1'});

console.log(bucketName); // "remotionlambda-32df3p"

参数

🌐 Arguments

一个具有以下属性的对象:

🌐 An object with the following property:

region

你想要创建存储桶的 AWS 区域

🌐 The AWS region which you want to create a bucket in.

enableFolderExpiryv4.0.32

When deploying sites, enable or disable S3 Lifecycle policies which allow for renders to auto-delete after a certain time. Default is null, which does not change any lifecycle policies of the S3 bucket. See: Lambda autodelete.

onBucketEnsured

在 v4.0 中移除

🌐 removed in v4.0

允许在桶创建后且启用 S3 网站选项之前传递回调。此选项的存在是为了让 CLI 能更好地可视化进度。 在 v4.0 中已移除,因为我们不再使用网站选项。

🌐 Allows to pass a callback after the bucket was created and before the S3 website option was enabled. This option exists so the CLI can better visualize the progress.
Removed in v4.0 since we don't use the website option anymore.

forcePathStyle?v4.0.202

forcePathStyle 传递给 AWS S3 客户端。如果你不知道这是什么,你很可能用不到它。

🌐 Passes forcePathStyle to the AWS S3 client. If you don't know what this is, you probably don't need it.

返回值

🌐 Return value

一个承诺,解析为具有以下属性的对象:

🌐 A promise resolving to an object with the following properties:

bucketName

找到或创建的存储桶的名称。

🌐 The name of your bucket that was found or created.

alreadyExistedv3.3.78

一个布尔值,指示桶是已存在还是新创建的。

🌐 A boolean indicating whether the bucket already existed or was newly created.

另请参阅

🌐 See also