Skip to main content
`Ctrl`+`K`

# LZMA

class numcodecs.lzma.LZMA(format=1, check=-1, preset=None, filters=None)

  Codec providing compression using lzma via the Python standard library.

  Parameters:
    format integer, optional

      One of the lzma format codes, e.g., `lzma.FORMAT_XZ`.

    check integer, optional

      One of the lzma check codes, e.g., `lzma.CHECK_NONE`.

    preset integer, optional

      An integer between 0 and 9 inclusive, specifying the compression level.

    filters list, optional

      A list of dictionaries specifying compression filters. If filters are provided, ‘preset’ must be None.

  codec_id: str | None = 'lzma'

    Codec identifier.

  encode(buf)

    Encode data in buf.

    Parameters:
      buf buffer-like

        Data to be encoded. May be any object supporting the new-style buffer protocol.

    Returns:
      enc buffer-like

        Encoded data. May be any object supporting the new-style buffer protocol.

  decode(buf, out=None)

    Decode data in buf.

    Parameters:
      buf buffer-like

        Encoded data. May be any object supporting the new-style buffer protocol.

      out buffer-like, optional

        Writeable buffer to store decoded data. N.B. if provided, this buffer must be exactly the right size to store the decoded data.

    Returns:
      dec buffer-like

        Decoded data. May be any object supporting the new-style buffer protocol.

  get_config()

    Return a dictionary holding configuration parameters for this codec. Must include an ‘id’ field with the codec identifier. All values must be compatible with JSON encoding.

  classmethod from_config(config)

    Instantiate codec from a configuration object.