Documentation ¶
Overview ¶
Package dec provides Brotli decoder bindings
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DecompressBuffer ¶
DecompressBuffer decompress a Brotli-encoded buffer. Uses decodedBuffer as the destination buffer unless it is too small, in which case a new buffer is allocated. Returns the slice of the decodedBuffer containing the output, or an error.
func DecompressBufferDict ¶
func DecompressBufferDict(encodedBuffer []byte, inputDict []byte, decodedBuffer []byte) ([]byte, error)
DecompressBufferDict decompress a Brotli-encoded buffer. Uses decodedBuffer as the destination buffer unless it is too small, in which case a new buffer is allocated. Returns the slice of the decodedBuffer containing the output, or an error.
Types ¶
type BrotliReader ¶
type BrotliReader struct {
// contains filtered or unexported fields
}
BrotliReader decompresses a Brotli-encoded stream using the io.Reader interface
Example ¶
archiveReader, _ := os.Open("data.bin.bro") brotliReader := NewBrotliReader(archiveReader) defer brotliReader.Close() decompressedWriter, _ := os.OpenFile("data.bin.unbro", os.O_CREATE|os.O_WRONLY, 0644) defer decompressedWriter.Close() io.Copy(decompressedWriter, brotliReader)
Output:
func NewBrotliReader ¶
func NewBrotliReader(stream io.Reader) *BrotliReader
NewBrotliReader returns a Reader that decompresses the stream from another reader.
Ensure that you Close the stream when you are finished in order to clean up the Brotli decompression state.
The internal decompression buffer defaults to 128kb
func NewBrotliReaderSize ¶
func NewBrotliReaderSize(stream io.Reader, size int) *BrotliReader
NewBrotliReaderSize is the same as NewBrotliReader, but allows the internal buffer size to be set.
The size of the internal buffer may be specified which will hold compressed data before being read by the decompressor
func (*BrotliReader) Close ¶
func (r *BrotliReader) Close() error
Close the reader and clean up any decompressor state.