Skip to main content

getOrCreateBucket()

在您的S3帐户中为Remotion Lambda创建一个存储桶。如果已经存在一个存储桶,则会返回该存储桶。

每个区域只需要一个存储桶 来使Remotion Lambda正常运行。

ts
import { getOrCreateBucket } from "@remotion/lambda";
 
const { bucketName } = await getOrCreateBucket({ region: "us-east-1" });
 
console.log(bucketName); // "remotionlambda-32df3p"
ts
import { getOrCreateBucket } from "@remotion/lambda";
 
const { bucketName } = await getOrCreateBucket({ region: "us-east-1" });
 
console.log(bucketName); // "remotionlambda-32df3p"

参数

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

region

您希望在其中创建存储桶的AWS区域

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中已移除,可选

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

forcePathStyle?v4.0.202

forcePathStyle传递给AWS S3客户端。如果您不知道这是什么,您可能不需要它。

返回值

一个解析为具有以下属性的对象的Promise:

bucketName

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

alreadyExistedv3.3.78

一个布尔值,指示存储桶是否已经存在或是新创建的。

参见