getSites()
获取你 S3 账户中的 Remotion 项目数组。
🌐 Gets an array of Remotion projects in your S3 account.
这些项目位于你 S3 存储桶的 sites/ 子目录中。请记住——每个区域的 Remotion Lambda 只应有一个存储桶,因此你无需为此函数指定存储桶的名称。
🌐 The projects are located in the sites/ subdirectory of your S3 bucket. Remember - you should only have one bucket for Remotion Lambda per region, therefore you do not need to specify the name of the bucket for this function.
示例
🌐 Example
获取所有站点并记录有关它们的信息。
🌐 Gets all sites and logs information about them.
import {getSites } from '@remotion/lambda/client';
const {sites , buckets } = await getSites ({
region : 'eu-central-1',
});
for (const site of sites ) {
console .log (site .id ); // A unique ID for referring to that project
console .log (site .bucketName ); // In which bucket the site resides in.
console .log (site .lastModified ); // A unix timestamp, but may also be null
console .log (site .sizeInBytes ); // Size of all contents in the folder
console .log (site .serveUrl ); // URL of the deployed site that you can pass to `renderMediaOnLambda()`
}
for (const bucket of buckets ) {
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.
}最好从 @remotion/lambda/client(从 v3.3.42 起可用)导入此函数,以避免 在无服务器函数中 出现问题。
参数
🌐 Arguments
一个具有以下属性的对象:
🌐 An object with the following properties:
region
你想查询的 AWS 区域。
🌐 The AWS region which you want to query.
forceBucketName?v3.3.102
指定要使用的特定存储桶名称。这不推荐,最好让 Remotion 自动发现正确的存储桶。
🌐 Specify a specific bucket name to be used. This is not recommended, instead let Remotion discover the right bucket automatically.
返回值
🌐 Return value
一个承诺,解析为具有以下属性的对象:
🌐 A promise resolving to an object with the following properties:
sites
一组已部署的 Remotion 项目,你可以用于渲染。
🌐 An array of deployed Remotion projects that you can use for rendering.
每个项目包含以下属性:
🌐 Each item contains the following properties:
id
该项目的唯一标识符。
🌐 A unique identifier for that project.
bucketName
项目所在的桶。
🌐 The bucket in which the project resides in.
lastModified
该项目中的文件上次被更改的时间。
🌐 When the files in that project were last changed.
sizeInBytes
该项目中所有文件的总大小。
🌐 The combined size of all files in that project.
serveUrl
已部署站点的 URL。你可以将其传入 renderMediaOnLambda() 来渲染视频或音频。
🌐 URL of the deployed site. You can pass it into renderMediaOnLambda() to render a video or audio.
buckets
你账户中所选区域中所有以 remotionlambda- 开头的存储桶数组。
🌐 An array of all buckets in the selected region in your account that start with remotionlambda-.
对于所有的 Remotion 项目,你每个区域只应有一个 1 个桶。尽管如此,buckets 是一个数组,因为我们无法阻止你使用 remotionlambda- 前缀手动创建额外的桶。
每个项目包含以下属性:
🌐 Each item contains the following properties:
region
桶所在的区域。
🌐 The region the bucket resides in.
name
桶的名称。S3 桶具有全局唯一的名称。
🌐 The name of the bucket. S3 buckets have globally unique names.
creationDate
桶首次创建时的 UNIX 时间戳。
🌐 A UNIX timestamp of the point when the bucket was first created.
另请参阅
🌐 See also