Skip to main content

speculateFunctionName()

从 v3.3.75 起可用

🌐 available from v3.3.75

推测将由 deployFunction() 或其 CLI 等效命令 npx remotion lambda functions deploy 创建的 Lambda 函数的名称。当 Lambda 函数的配置提前已知,并且需要函数名称时,这可能会很有用。

🌐 Speculate the name of the Lambda function that will be created by deployFunction() or its CLI equivalent, npx remotion lambda functions deploy. This could be useful in cases when the configuration of the Lambda function is known in advance, and the name of the function is needed.

如果你不确定某个函数是否存在,请使用 getFunctionInfo() 并捕获如果该函数不存在时抛出的错误。

🌐 If you are not sure whether a function exists, use getFunctionInfo() and catch the error that gets thrown if it does not exist.

如果你想获取已部署函数的列表,请使用 getFunctions() 替代。

🌐 If you want to get a list of deployed functions, use getFunctions() instead.

函数名称模式

🌐 Function name pattern

一个 Remotion Lambda 函数的命名总是像这样:

🌐 A Remotion Lambda function is always names like this:

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

了解更多 关于此公约。

示例

🌐 Example

import {speculateFunctionName} from '@remotion/lambda/client';

const speculatedFunctionName = speculateFunctionName({
  memorySizeInMb: 2048,
  diskSizeInMb: 2048,
  timeoutInSeconds: 120,
});

console.log(speculatedFunctionName); // remotion-render-3-3-63-mem2048mb-disk2048mb-120sec

参数

🌐 Arguments

一个具有以下属性的对象:

🌐 An object with the following properties:

memorySizeInMb

分配给函数的内存量。

🌐 The amount of memory allocated to the function.

diskSizeInMb

分配给该函数的磁盘空间量。

🌐 The amount of disk space allocated to the function.

timeoutInSeconds

已分配给 Lambda 函数的超时时间。

🌐 The timeout that has been assigned to the Lambda function.

返回值

🌐 Return value

将要创建的函数的名称字符串。

🌐 A string with the name of the function that will be created.

另请参阅

🌐 See also