Capítulo 756 de 988

Chapter 756: Asset cleanup

Core Idea

You are responsible for cleaning up assets that were added by the user and are no longer needed. Assets may lay around in S3 storage buckets and in the local IndexedDB asset cache.

Key Concepts

  • When it is safe to delete assets
  • Getting deleted assets
  • Deleting assets
  • Deleting assets from IndexedDB
  • Deleting assets from S3
  • Removing from the state
  • See also

Code Examples

const {REMOTION_AWS_BUCKET_NAME, REMOTION_AWS_REGION} = requireServerEnv();

const {client, sdk} = getAwsClient({
  region: REMOTION_AWS_REGION,
  service: 's3',
});

const command = new sdk.DeleteObjectCommand({
  Bucket: REMOTION_AWS_BUCKET_NAME,
  Key: remoteFileKey,
});

await client.send(command);
  • What it demonstrates: Usage pattern for Asset cleanup from the official docs.

Key Takeaways

  1. Understand when it is safe to delete assets when working with Asset cleanup.
  2. Understand getting deleted assets when working with Asset cleanup.
  3. Understand deleting assets when working with Asset cleanup.
  4. Understand deleting assets from indexeddb when working with Asset cleanup.
  5. Understand deleting assets from s3 when working with Asset cleanup.

Connects To

  • Asset Uploads: related page in the Editor Starter Template section.
  • Backend Routes: related page in the Editor Starter Template section.
  • Before you buy: related page in the Editor Starter Template section.