struct.go 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. // Copyright 2010 The Go Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style
  3. // license that can be found in the LICENSE file.
  4. /*
  5. Package zip provides support for reading and writing ZIP archives.
  6. See the [ZIP specification] for details.
  7. This package does not support disk spanning.
  8. A note about ZIP64:
  9. To be backwards compatible the FileHeader has both 32 and 64 bit Size
  10. fields. The 64 bit fields will always contain the correct value and
  11. for normal archives both fields will be the same. For files requiring
  12. the ZIP64 format the 32 bit fields will be 0xffffffff and the 64 bit
  13. fields must be used instead.
  14. [ZIP specification]: https://support.pkware.com/pkzip/appnote
  15. */
  16. package zip
  17. // Compression methods.
  18. const (
  19. Store uint16 = 0 // no compression
  20. Deflate uint16 = 8 // DEFLATE compressed
  21. )
  22. const (
  23. fileHeaderSignature = 0x04034b50
  24. directoryHeaderSignature = 0x02014b50
  25. directoryEndSignature = 0x06054b50
  26. directory64LocSignature = 0x07064b50
  27. directory64EndSignature = 0x06064b50
  28. dataDescriptorSignature = 0x08074b50 // de-facto standard; required by OS X Finder
  29. fileHeaderLen = 30 // + filename + extra
  30. directoryHeaderLen = 46 // + filename + extra + comment
  31. directoryEndLen = 22 // + comment
  32. dataDescriptorLen = 16 // four uint32: descriptor signature, crc32, compressed size, size
  33. dataDescriptor64Len = 24 // two uint32: signature, crc32 | two uint64: compressed size, size
  34. directory64LocLen = 20 //
  35. directory64EndLen = 56 // + extra
  36. )