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

Support chunked file writing #12

Open
adam-azarchs opened this issue Dec 7, 2023 · 0 comments
Open

Support chunked file writing #12

adam-azarchs opened this issue Dec 7, 2023 · 0 comments

Comments

@adam-azarchs
Copy link

This is really a superset of #4.

Currently,

ar/writer.go

Lines 93 to 96 in 809d437

if len(b)%2 == 1 { // data size must be aligned to an even byte
n2, _ := aw.w.Write([]byte{'\n'})
return n+n2, err
}

essentially closes the file after each call to Write, which means you can't use the API to write a file one piece at a time (e.g. with io.Copy, or dumping out from a stream),

It should only write that footer when aw.nb == 0.

In my opinion, the best way to handle this would be to follow the example of archive/tar and don't write the file footer until either the next call to WriteHeader() or Close(). Of course that would require introduction of a Close method, which would be a breaking API change.

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

No branches or pull requests

1 participant