getSites()
获取您的S3帐户中的Remotion项目数组。
这些项目位于您的S3存储桶的sites/
子目录中。请记住 - 每个区域的Remotion Lambda应该只有一个存储桶,因此您不需要为此函数指定存储桶的名称。
示例
获取所有站点并记录有关它们的信息。
ts
import {getSites } from "@remotion/lambda/client";const {sites ,buckets } = awaitgetSites ({region : "eu-central-1",});for (constsite ofsites ) {console .log (site .id ); // A unique ID for referring to that projectconsole .log (site .bucketName ); // In which bucket the site resides in.console .log (site .lastModified ); // A unix timestamp, but may also be nullconsole .log (site .sizeInBytes ); // Size of all contents in the folderconsole .log (site .serveUrl ); // URL of the deployed site that you can pass to `renderMediaOnLambda()`}for (constbucket ofbuckets ) {console .log (bucket .region ); // 'eu-central-1'console .log (bucket .name ); // The name of the S3 bucket.console .log (bucket .creationDate ); // A unix timestamp of when the site was created.}
ts
import {getSites } from "@remotion/lambda/client";const {sites ,buckets } = awaitgetSites ({region : "eu-central-1",});for (constsite ofsites ) {console .log (site .id ); // A unique ID for referring to that projectconsole .log (site .bucketName ); // In which bucket the site resides in.console .log (site .lastModified ); // A unix timestamp, but may also be nullconsole .log (site .sizeInBytes ); // Size of all contents in the folderconsole .log (site .serveUrl ); // URL of the deployed site that you can pass to `renderMediaOnLambda()`}for (constbucket ofbuckets ) {console .log (bucket .region ); // 'eu-central-1'console .log (bucket .name ); // The name of the S3 bucket.console .log (bucket .creationDate ); // A unix timestamp of when the site was created.}
note
最好从@remotion/lambda/client
(从v3.3.42可用)导入此函数,以避免在无服务器函数内部出现问题。
参数
一个具有以下属性的对象:
region
您要查询的AWS区域。
forceBucketName?
v3.3.102
可选
指定要使用的特定存储桶名称。不建议这样做,而是让Remotion自动发现正确的存储桶。
返回值
解析为具有以下属性的对象的Promise:
sites
您可以用于渲染的已部署Remotion项目的数组。
每个项目包含以下属性:
id
该项目的唯一标识符。
bucketName
项目所在的存储桶。
lastModified
该项目中的文件上次更改的时间。
sizeInBytes
该项目中所有文件的组合大小。
serveUrl
部署站点的URL。您可以将其传递给renderMediaOnLambda()
以渲染视频或音频。
buckets
您帐户中所选区域中以remotionlambda-
开头的所有存储桶的数组。
info
您应该每个区域只有1个存储桶用于所有Remotion项目。尽管buckets
是一个数组,但我们无法阻止您手动创建具有remotionlambda-
前缀的附加存储桶。
每个项目包含以下属性:
region
存储桶所在的地区。
name
存储桶的名称。S3 存储桶具有全局唯一的名称。
creationDate
存储桶首次创建时的 UNIX 时间戳。