Skip to content

proposal: archive/zip: NewZipWriter should support Ahead-of-time CRC and Sizes #23301

Description

@steve-gray

Golang's archive/zip does not support pre-calculation of the file sizes and CRC statistics used in the PKZIP file header structure, requiring use of the 'Content Descriptor' general purpose flag and appending a structure after each included file. This flag is not compatible with various older software, precluding archive/zip from being used in some application scenarios.

What version of Go are you using (go version)?

1.9

Does this issue reproduce with the latest release?

Yes

What operating system and processor architecture are you using (go env)?

OSX High Sierra (Intel x64)

What did you do?

  • When writing zip files, Golang always defaults to the 'Content Descriptor' method. Some legacy applications do not understand the 0x08 'general purpose' flag, and when content size is known in advance,

What did you expect to see?

  • Ability to set 'PrecalculateSize' flag on writer or similiar, to avoid writing Content Descriptor structure and use pre-computed fields in the file header within the central directory.

What did you see instead?

  • Go's zip output differs from WinZip/OSX/Linux zip command output, because file size header is set to 0 and file is followed by a Content Descriptor.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions