lz4
lz4 copied to clipboard
Add lz4.AppendOption for NewWriter
Add lz4.AppendOption, if NewWriter set lz4.AppendOption(true) ,then will not write header.
In this way, you can continue to write new data on the existing lz4 file.
like this:
//
fw, _ := os.OpenFile(path, os.O_CREATE|os.O_RDWR|os.O_APPEND, 0644)
w := lz4.NewWriter(fw)
w.Apply(lz4.ChecksumOption(false))
w.Write(d)
w.Flush()
// do some other thing, or a long time later
fw, _ := os.OpenFile(path, os.O_CREATE|os.O_RDWR|os.O_APPEND, 0644)
w := lz4.NewWriter(fw)
w.Apply(lz4.ChecksumOption(false), lz4.AppendOption(true))
w.Write(d)
w.Flush()
Thank