getOrCreateBucket()
在您的 GCP 项目中为 Remotion Cloud Run 创建一个 Cloud Storage 存储桶。如果已经存在一个存储桶,则会返回该存储桶。
每个区域只需要 1 个存储桶 以使 Remotion Cloud Run 正常运行。
ts
import {getOrCreateBucket } from "@remotion/cloudrun";const {bucketName ,alreadyExisted } = awaitgetOrCreateBucket ({region : "us-east1",});console .log (bucketName ); // "remotioncloudrun-32df3p"
ts
import {getOrCreateBucket } from "@remotion/cloudrun";const {bucketName ,alreadyExisted } = awaitgetOrCreateBucket ({region : "us-east1",});console .log (bucketName ); // "remotioncloudrun-32df3p"
参数
一个具有以下属性的对象:
region
您希望在其中创建存储桶的 GCP 区域。
updateBucketState?
可选
返回操作状态(字符串)的回调函数。CLI 使用此函数提供进度更新。状态将是以下之一;
- 检查现有存储桶
- 创建新存储桶
- 已创建存储桶
- 使用现有存储桶
返回值
解析为具有以下属性的对象的 Promise:
bucketName
找到或创建的存储桶的名称。
alreadyExisted
一个布尔值,指示存储桶是否已经存 在或是新创建的。