• Returns the maximum length of buffer needed for compression of input of the given length.

    Returns 0 if the length is too large.

    Snappy format specifications limits the maximum uncompressed length to 2^32-1, but since JavaScript runtimes can't allocate so much anyway, and Snappy framing format uses no longer than 65536-byte chunks, we limit the maximum compressed size to 2^31-1 = 0x7FFFFFFF, which requires that the maximum uncompressed size is 1840700241 bytes (0x7FFFFFFF ~= 32 + x + x/6).

    Current JavaScript VMs will still most likely fail to allocate that much, so it is a good idea to limit source length to something smaller.

    Parameters

    • srcLen: number

    Returns number