Skip to content
This repository has been archived by the owner on Nov 19, 2024. It is now read-only.

Commit

Permalink
Add exported encoder/decoder opts for zstd
Browse files Browse the repository at this point in the history
  • Loading branch information
Dean-Coakley authored and AJ ONeal committed Oct 24, 2020
1 parent 279e87c commit 858e52c
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions zstd.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,13 @@ import (

// Zstd facilitates Zstandard compression.
type Zstd struct {
EncoderOptions []zstd.EOption
DecoderOptions []zstd.DOption
}

// Compress reads in, compresses it, and writes it to out.
func (zs *Zstd) Compress(in io.Reader, out io.Writer) error {
w, err := zstd.NewWriter(out)
w, err := zstd.NewWriter(out, zs.EncoderOptions...)
if err != nil {
return err
}
Expand All @@ -25,7 +27,7 @@ func (zs *Zstd) Compress(in io.Reader, out io.Writer) error {

// Decompress reads in, decompresses it, and writes it to out.
func (zs *Zstd) Decompress(in io.Reader, out io.Writer) error {
r, err := zstd.NewReader(in)
r, err := zstd.NewReader(in, zs.DecoderOptions...)
if err != nil {
return err
}
Expand Down

0 comments on commit 858e52c

Please sign in to comment.