From ee1551c1028d90ff55f7f87a2724fbd4fa42b91f Mon Sep 17 00:00:00 2001 From: name Date: Thu, 13 Oct 2022 01:29:42 +0800 Subject: [PATCH] Add lz4.AppendOption, if NewWriter set lz4.AppendOption(true) ,then will not write header --- options.go | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/options.go b/options.go index 46a87380..402abc4a 100644 --- a/options.go +++ b/options.go @@ -92,6 +92,23 @@ func ChecksumOption(flag bool) Option { } } +// AppendOption if appendToLz4File = true ,then will not write header +func AppendOption(appendToLz4File bool) Option { + return func(a applier) error { + switch w := a.(type) { + case nil: + s := fmt.Sprintf("AppendOption(%v)", appendToLz4File) + return lz4errors.Error(s) + case *Writer: + if appendToLz4File { + w.frame.Descriptor.Checksum = 1 + } + return nil + } + return lz4errors.ErrOptionNotApplicable + } +} + // SizeOption sets the size of the original uncompressed data (default=0). It is useful to know the size of the // whole uncompressed data stream. func SizeOption(size uint64) Option {