Logos DX
    Preparing search index...

    Variable byteUnitsConst

    byteUnits: {
        gb: number;
        kb: number;
        mb: number;
        tb: number;
        gbs(n: number): number;
        kbs(n: number): number;
        mbs(n: number): number;
        tbs(n: number): number;
    } = ...

    Byte size unit constants and helper functions for data size calculations.

    Provides byte values for common size units (KB, MB, GB, TB) using binary units (1024-based). Useful for file size limits, memory calculations, and data transfer limits.

    WHY: Improves code readability by using human-friendly size units instead of raw bytes. Instead of writing maxSize: 5242880, you can write maxSize: byteUnits.mbs(5).

    Type Declaration

    // Using predefined constants
    const maxFileSize = byteUnits.mb * 10; // 10 MB
    if (fileSize > byteUnits.gb) console.log('File larger than 1GB');
    // Using helper functions
    const uploadLimit = byteUnits.mbs(50); // 50 megabytes
    const diskQuota = byteUnits.gbs(100); // 100 gigabytes