@earth-app/collegedb
    Preparing search index...

    Function getDatabaseSizeForShard

    • Gets the size of a specific D1 database in bytes. Uses efficient SQLite pragma queries to determine database size.

      Parameters

      • shardBinding: string

        The shard binding name to check the size of

      Returns Promise<number>

      Promise resolving to the database size in bytes

      If shard not found or size query fails

      // Get size of a specific shard
      const sizeInBytes = await getDatabaseSizeForShard('db-east');
      console.log(`Database size: ${Math.round(sizeInBytes / 1024 / 1024)} MB`);