Capítulo 475 de 988

Chapter 475: getSites()

Core Idea

Gets an array of Remotion projects in your S3 account.

Key Concepts

  • Example
  • Arguments
  • region
  • forceBucketName?<AvailableFrom v="3.3.102"/>
  • compatibleOnly?<AvailableFrom v="4.0.435"/>
  • Return value
  • sites
  • id

Code Examples

const {sites, buckets} = await getSites({
  region: 'eu-central-1',
});

for (const site of sites) {
  console.log(site.id); // A unique ID for referring to that project
  console.log(site.bucketName); // In which bucket the site resides in.
  console.log(site.lastModified); // A unix timestamp, but may also be null
  console.log(site.sizeInBytes); // Size of all contents in the folder
  console.log(site.serveUrl); // URL of the deployed site that you can pass to `renderMediaOnLambda()`
  console.log(site.version); // The Remotion version of the site, or null
}

for (const bucket of buckets) {
  console.log(bucket.region); // 'eu-central-1'
  console.log(bucket.name); // The name of the S3 bucket.
  console.log(bucket.creationDate); // A unix timestamp of when the site was created.
}
  • What it demonstrates: Usage pattern for getSites() from the official docs.

Key Takeaways

  1. Understand example when working with getSites().
  2. Understand arguments when working with getSites().
  3. Understand region when working with getSites().
  4. Understand forcebucketname?<availablefrom v="3.3.102"/> when working with getSites().
  5. Understand compatibleonly?<availablefrom v="4.0.435"/> when working with getSites().

Connects To

  • api: related page in the Lambda (@remotion/lambda) section.
  • Approuterwebhook: related page in the Lambda (@remotion/lambda) section.
  • Authentication: related page in the Lambda (@remotion/lambda) section.