GeoLeaf Core API - v3.0.0
    Preparing search index...
    CacheMetrics: {
        estimateProfileSize(
            profileId: string,
            resources: ResourceWithUrl[],
            options?: { maxSamples?: number; headConcurrency?: number },
        ): Promise<
            {
                totalSize: number;
                totalSizeFormatted: string;
                byType: SizeByType;
                sampleCount: number;
                resourceCounts: {
                    total: number;
                    tiles: number;
                    layers: number;
                    config: number;
                    others: number;
                };
            },
        >;
        formatBytes(bytes: number, decimals?: number): string;
    } = ...

    CacheMetrics - Cache statistics, quota management, and reporting

    Type Declaration

    • estimateProfileSize: function
      • Estimate profile size before download Uses HEAD requests on sample resources

        Parameters

        • profileId: string

          Profile ID

        • resources: ResourceWithUrl[]

          Array of resource objects

        • Optionaloptions: { maxSamples?: number; headConcurrency?: number } = {}

          Options { maxSamples: 50 }

        Returns Promise<
            {
                totalSize: number;
                totalSizeFormatted: string;
                byType: SizeByType;
                sampleCount: number;
                resourceCounts: {
                    total: number;
                    tiles: number;
                    layers: number;
                    config: number;
                    others: number;
                };
            },
        >

        Estimation { totalSize, byType: {...}, sampleCount }

        const estimate = await metrics.estimateProfileSize('myprofile', resources);
        console.log(`Estimated size: ${estimate.totalSizeFormatted}`);
        console.log(`Breakdown: ${estimate.byType.tiles} tiles, ${estimate.byType.layers} layers`);
    • formatBytes: function
      • Format bytes to human-readable string

        Parameters

        • bytes: number

          Size in bytes

        • Optionaldecimals: number = 2

          Decimal places

        Returns string

        Formatted string (e.g., "1.23 MB")