speculateFunctionName()
从 v3.3.75 版本开始可用
推测由 deployFunction()
或其 CLI 等效项 npx remotion lambda functions deploy
创建的 Lambda 函数的名称。在已知 Lambda 函数配置并且需要函数名称的情况下,这可能会很有用。
如果不确定函数是否存在,请使用 getFunctionInfo()
并捕获如果函数不存在则抛出的错误。
如果要获取已部署函数的列表,请改用 getFunctions()
。
函数名称模式
Remotion Lambda 函数的名称始终如下:
txt
remotion-render-3-3-63-mem2048mb-disk2048mb-240sec^^^^^^ ^^^^ ^^^ ^^^| | | |-- Timeout in seconds| | |--------- Disk size in MB| |------------------- Memory size in MB|----------------------------- Remotion version with dots replaced by dashes
txt
remotion-render-3-3-63-mem2048mb-disk2048mb-240sec^^^^^^ ^^^^ ^^^ ^^^| | | |-- Timeout in seconds| | |--------- Disk size in MB| |------------------- Memory size in MB|----------------------------- Remotion version with dots replaced by dashes
了解更多 关于此约定。
示例
ts
import {speculateFunctionName } from "@remotion/lambda/client";constspeculatedFunctionName =speculateFunctionName ({memorySizeInMb : 2048,diskSizeInMb : 2048,timeoutInSeconds : 120,});console .log (speculatedFunctionName ); // remotion-render-3-3-63-mem2048mb-disk2048mb-120sec
ts
import {speculateFunctionName } from "@remotion/lambda/client";constspeculatedFunctionName =speculateFunctionName ({memorySizeInMb : 2048,diskSizeInMb : 2048,timeoutInSeconds : 120,});console .log (speculatedFunctionName ); // remotion-render-3-3-63-mem2048mb-disk2048mb-120sec
参数
一个具有以下属性的对象:
memorySizeInMb
分配给函数的内存量。
diskSizeInMb
分配给函数的磁盘空间量。
timeoutInSeconds
分配给 Lambda 函数的超时时间。
返回值
一个包含将要创建的函数名称的字符串。
另请参阅
- 此函数的源代码
- deployFunction()
deployFunction()
的 CLI 版本:npx remotion lambda functions deploy