Documentation ¶
Overview ¶
Package zstd provides a high-level API for reading and writing zstd-compressed data. It supports both regular and seekable zstd streams. It's not a new wheel, but a wrapper around the zstd and zstd-seekable-format-go packages.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( WithEncoderCRC = zstd.WithEncoderCRC WithEncoderConcurrency = zstd.WithEncoderConcurrency WithWindowSize = zstd.WithWindowSize WithEncoderPadding = zstd.WithEncoderPadding WithEncoderLevel = zstd.WithEncoderLevel WithZeroFrames = zstd.WithZeroFrames WithAllLitEntropyCompression = zstd.WithAllLitEntropyCompression WithNoEntropyCompression = zstd.WithNoEntropyCompression WithSingleSegment = zstd.WithSingleSegment WithLowerEncoderMem = zstd.WithLowerEncoderMem WithEncoderDict = zstd.WithEncoderDict WithEncoderDictRaw = zstd.WithEncoderDictRaw )
var ( WithDecoderLowmem = zstd.WithDecoderLowmem WithDecoderConcurrency = zstd.WithDecoderConcurrency WithDecoderMaxMemory = zstd.WithDecoderMaxMemory WithDecoderDicts = zstd.WithDecoderDicts WithDecoderDictRaw = zstd.WithDecoderDictRaw WithDecoderMaxWindow = zstd.WithDecoderMaxWindow WithDecodeAllCapLimit = zstd.WithDecodeAllCapLimit WithDecodeBuffersBelow = zstd.WithDecodeBuffersBelow IgnoreChecksum = zstd.IgnoreChecksum )
Functions ¶
This section is empty.
Types ¶
type EncoderLevel ¶
type EncoderLevel = zstd.EncoderLevel
const ( SpeedFastest EncoderLevel = zstd.SpeedFastest SpeedDefault EncoderLevel = zstd.SpeedDefault SpeedBetterCompression EncoderLevel = zstd.SpeedBetterCompression SpeedBestCompression EncoderLevel = zstd.SpeedBestCompression )
type Reader ¶
type ReaderOption ¶
type SeekableReader ¶
type SeekableReader struct {
// contains filtered or unexported fields
}
func NewSeekableReader ¶
func NewSeekableReader(r io.ReadSeeker, opts ...ReaderOption) (*SeekableReader, error)
NewSeekableReader returns a zstd reader to decompress data from seekable format.
func (*SeekableReader) Close ¶
func (r *SeekableReader) Close() error
type SeekableWriter ¶
type SeekableWriter struct {
// contains filtered or unexported fields
}
func NewSeekableWriter ¶
func NewSeekableWriter(w io.Writer, blockSize int, opts ...WriterOption) (*SeekableWriter, error)
NewSeekableWriter returns a zstd writer to compress data to seekable format. blockSize is an important parameter, it should be decided according to the actual business requirements. If it's too small, the compression ratio could be very bad, even no compression at all. If it's too large, it could cost more traffic when reading the data partially from underlying storage.
func (*SeekableWriter) Close ¶
func (w *SeekableWriter) Close() error