lz4

package module
v0.0.0-...-caecf3c Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 16, 2024 License: BSD-3-Clause Imports: 4 Imported by: 180

README

golz4

Golang interface to LZ4 compression

Documentation

Overview

Package lz4 implements compression using lz4.c and lz4hc.c

Copyright (c) 2013 CloudFlare, Inc.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Compress

func Compress(in, out []byte) (outSize int, err error)

Compress compresses in and puts the content in out. len(out) should have enough space for the compressed data (use CompressBound to calculate). Returns the number of bytes in the out slice.

func CompressBound

func CompressBound(in []byte) int

CompressBound calculates the size of the output buffer needed by Compress. This is based on the following macro:

#define LZ4_COMPRESSBOUND(isize)

((unsigned int)(isize) > (unsigned int)LZ4_MAX_INPUT_SIZE ? 0 : (isize) + ((isize)/255) + 16)

func CompressHC

func CompressHC(in, out []byte) (int, error)

CompressHC compresses in and puts the content in out. len(out) should have enough space for the compressed data (use CompressBound to calculate). Returns the number of bytes in the out slice. Determines the compression level automatically.

func CompressHCLevel

func CompressHCLevel(in, out []byte, level int) (outSize int, err error)

CompressHCLevel compresses in at the given compression level and puts the content in out. len(out) should have enough space for the compressed data (use CompressBound to calculate). Returns the number of bytes in the out slice. To automatically choose the compression level, use 0. Otherwise, use any value in the inclusive range 1 (worst) through 16 (best). Most applications will prefer CompressHC.

func Uncompress

func Uncompress(in, out []byte) error

Uncompress with a known output size. len(out) should be equal to the length of the uncompressed out.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL