Function compress

  • Compresses srcBuf into dstBuf at compression level level.

    dstBuf must be large enough to fit the entire result. See compressBound for a way to compute an upper bound on that size.

    Wraps ZSTD_compress.

    Parameters

    • dstBuf: Uint8Array

      Output buffer for compressed bytes

    • srcBuf: Uint8Array

      Data to compress

    • level: number

      Compression level

    Returns number

    Number of compressed bytes written to dstBuf

    This function is here for completeness, creating a CCtx and reusing it will give better performance than calling this repeatedly. The high-level compress function will take care of this for you.