Skip to main content

deleteSite()

从你的 S3 存储桶中移除一个 Remotion 项目。

🌐 Removes a Remotion project from your S3 bucket.

每个项目都位于你的 S3 存储桶的 sites/ 子目录中。调用此函数相当于删除 sites/ 子目录中某个子文件夹内的所有文件。

🌐 Each project is located in the sites/ subdirectory of your S3 bucket. Calling this function is equivalent of deleting all files inside a subfolder of your sites/ subdirectory.

示例

🌐 Example

获取所有站点并删除它们。

🌐 Gets all sites and deletes them.

import {AwsRegion, deleteSite, getSites} from '@remotion/lambda';

const region: AwsRegion = 'eu-central-1';

const {sites} = await getSites({
  region,
});

for (const site of sites) {
  await deleteSite({
    bucketName: site.bucketName,
    siteName: site.id,
    region,
  });
  console.log(`Site ${site.id} deleted.`);
}

参数

🌐 Arguments

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

🌐 An object with the following properties:

region

string

项目所在的 AWS 区域

🌐 The AWS region where the project resides in.

bucketName

string

你的网站所在的 S3 存储桶的名称。

🌐 The name of the S3 bucket in which your site resides in.

siteName

string

你想要删除的项目的唯一ID。

🌐 The unique ID of the project you want to delete.

forcePathStyle?v4.0.202

forcePathStyle 传递给 AWS S3 客户端。如果你不知道这是什么,你很可能用不到它。

🌐 Passes forcePathStyle to the AWS S3 client. If you don't know what this is, you probably don't need it.

返回值

🌐 Return value

一个承诺解析为具有以下属性的对象:

🌐 A promise resolving to an object with the following property:

totalSizeInBytes

number

通过删除项目释放的空间量。

🌐 The amount of space that was freed by deleting the project.

另请参阅

🌐 See also