Documentation ¶
Overview ¶
Package zt provides types and functions that allow to transparently handle an incoming stream of bytes, whether it's compressed – by decompressing it on the fly – or uncompressed, in which case the bytes are simply forwarded as-is.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewReader ¶
func NewReader(r io.Reader) (io.ReadCloser, error)
NewReader returns an io.ReadCloser that reads from r, either decoding the compressed stream (in case the algorithm used to compress it is both supported and detected), or just forwarding it.
In order for NewReader to succeeds, at least 4 bytes must be read from r, in order to detect the presence of a compression algorithm and its type.
Note: this utility provided as a best effort, it's certainly possible to trick it into thinking a stream of bytes contains zstd or gzip compressed data, while in fact it's not.
Types ¶
This section is empty.