getFunctions()
检索 Remotion 在某个区域部署到 AWS Lambda 的函数列表。
🌐 Retrieves a list of functions that Remotion deployed to AWS Lambda in a certain region.
参数 compatibleOnly 决定是否仅返回与已安装版本的 Remotion Lambda 兼容的函数。
🌐 The parameter compatibleOnly determines whether only functions that are compatible with the installed version of Remotion Lambda should be returned.
Lambda 函数是有版本的,函数的版本必须与 @remotion/lambda 包的版本匹配。所以如果你升级 Remotion,你应该部署一个新的函数,否则你可能会从这个函数得到一个空数组。
要获取有关单个函数的信息,请使用 getFunctionInfo()。
🌐 To get information about only a single function, use getFunctionInfo().
如果你确定一个函数存在,你也可以使用 speculateFunctionName() 猜测它的名称,从而节省对 Lambda 的 API 调用。
🌐 If you are sure that a function exists, you can also guess the name of it using speculateFunctionName() and save an API call to Lambda.
示例
🌐 Example
import {getFunctions } from '@remotion/lambda/client';
const info = await getFunctions ({
region : 'eu-central-1',
compatibleOnly : true,
});
for (const fn of info ) {
console .log (fn .functionName ); // "remotion-render-d8a03x"
console .log (fn .memorySizeInMb ); // 1536
console .log (fn .timeoutInSeconds ); // 120
console .log (fn .diskSizeInMb ); // 2048
console .log (fn .version ); // "2021-07-25"
}最好从 @remotion/lambda/client 导入这个函数,以避免 在无服务器函数中 出现问题。
参数
🌐 Argument
一个包含以下属性的对象:
🌐 An object containing the following properties:
region
你想查询的 AWS 区域。
🌐 The AWS region that you would like to query.
logLevel?v4.0.115
One of trace, verbose, info, warn, error.Determines how much info is being logged to the console.
Default
info.
compatibleOnly
如果 true,只会返回与当前 Remotion Lambda 包版本匹配的函数。如果 false,则返回所有函数。
🌐 If true, only functions that match the version of the current Remotion Lambda package are returned. If false, all functions are returned.
返回值
🌐 Return value
一个承诺解析为具有以下属性的对象数组:
🌐 A promise resolving to an array of objects with the following properties:
functionName
函数的名称。
🌐 The name of the function.
memorySizeInMb
分配给函数的内存量。
🌐 The amount of memory allocated to the function.
diskSizeInMb
分配给该函数的临时磁盘存储量。
🌐 The amount of ephemereal disk storage allocated to the function.
version
函数的版本。Remotion 对 Lambda 函数进行版本控制,并且渲染只能从与函数版本匹配的 @remotion/lambda 版本触发。
🌐 The version of the function. Remotion is versioning the Lambda function and a render can only be triggered from a version of @remotion/lambda that is matching the one of the function.
timeoutInSeconds
已分配给 Lambda 函数的超时时间。
🌐 The timeout that has been assigned to the Lambda function.
另请参阅
🌐 See also