Skip to content

Support chunked file writing #12

@adam-azarchs

Description

@adam-azarchs

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions