Module zipfile
[hide private]
[frames] | no frames]

Module zipfile

Read and write ZIP files.

Classes [hide private]
BadZipfile
LargeZipFile
Raised when writing a zipfile, the zipfile requires ZIP64 extensions and those extensions are disabled.
error
ZipInfo
Class with attributes describing each file in the ZIP archive.
ZipFile
Class with methods to open, read, write, close, list zip files.
PyZipFile
Class to create ZIP archives with Python library files and packages.
Functions [hide private]
 
is_zipfile(filename)
Quickly see if file is a ZIP file by checking the magic number.
 
_EndRecData64(fpin, offset, endrec)
Read the ZIP64 end-of-archive records and use that to update endrec
 
_EndRecData(fpin)
Return data from the "End of Central Directory" record, or None.
 
main(args=None)
Variables [hide private]
  ZIP64_LIMIT = 2147483647
  ZIP_STORED = 0
  ZIP_DEFLATED = 8
  structEndArchive = '<4s4H2lH'
  stringEndArchive = 'PK\x05\x06'
  structCentralDir = '<4s4B4HlLL5HLl'
  stringCentralDir = 'PK\x01\x02'
  structFileHeader = '<4s2B4HlLL2H'
  stringFileHeader = 'PK\x03\x04'
  structEndArchive64Locator = '<4slql'
  stringEndArchive64Locator = 'PK\x06\x07'
  structEndArchive64 = '<4sqhhllqqqq'
  stringEndArchive64 = 'PK\x06\x06'
  _CD_SIGNATURE = 0
  _CD_CREATE_VERSION = 1
  _CD_CREATE_SYSTEM = 2
  _CD_EXTRACT_VERSION = 3
  _CD_EXTRACT_SYSTEM = 4
  _CD_FLAG_BITS = 5
  _CD_COMPRESS_TYPE = 6
  _CD_TIME = 7
  _CD_DATE = 8
  _CD_CRC = 9
  _CD_COMPRESSED_SIZE = 10
  _CD_UNCOMPRESSED_SIZE = 11
  _CD_FILENAME_LENGTH = 12
  _CD_EXTRA_FIELD_LENGTH = 13
  _CD_COMMENT_LENGTH = 14
  _CD_DISK_NUMBER_START = 15
  _CD_INTERNAL_FILE_ATTRIBUTES = 16
  _CD_EXTERNAL_FILE_ATTRIBUTES = 17
  _CD_LOCAL_HEADER_OFFSET = 18
  _FH_SIGNATURE = 0
  _FH_EXTRACT_VERSION = 1
  _FH_EXTRACT_SYSTEM = 2
  _FH_GENERAL_PURPOSE_FLAG_BITS = 3
  _FH_COMPRESSION_METHOD = 4
  _FH_LAST_MOD_TIME = 5
  _FH_LAST_MOD_DATE = 6
  _FH_CRC = 7
  _FH_COMPRESSED_SIZE = 8
  _FH_UNCOMPRESSED_SIZE = 9
  _FH_FILENAME_LENGTH = 10
  _FH_EXTRA_FIELD_LENGTH = 11

Imports: struct, os, time, sys, binascii, cStringIO, zlib


Function Details [hide private]

_EndRecData(fpin)

 

Return data from the "End of Central Directory" record, or None.

The data is a list of the nine items in the ZIP "End of central dir" record followed by a tenth item, the file seek offset of this record.