Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add lz4.AppendOption for NewWriter #199

Open
wants to merge 1 commit into
base: v4
Choose a base branch
from

Conversation

xiaojun207
Copy link

@xiaojun207 xiaojun207 commented Oct 12, 2022

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant