ZipContainer

public class ZipContainer

Provides function to open ZIP archives (containers).

  • Undocumented

    Declaration

    Swift

    public class ZipContainer
  • Undocumented

    Declaration

    Swift

    public class ZipContainer
  • Undocumented

    Declaration

    Swift

    public class ZipContainer
  • Processes ZIP archive (container) and returns an array of tuples (String, Data). First member of a tuple is entry’s name, second member is entry’s data.

    Important

    The order of entries is defined by ZIP archive and, particularly, creator of given ZIP container. It is likely that directories will be encountered earlier than files stored in those directories, but one SHOULD NOT assume that this is the case.

    Note

    Currently, there is no universal (platform and file system independent) method to determine if entry is a directory. One can check this by looking at the size of entry’s data (it should be 0 for directory) AND the last character of entry’s name (it should be ‘/’). If all of these is true then entry is likely to be a directory.

    Note

    Only ZIP containers complying to ISO/IEC 21320-1 standard are supported.

    Throws

    ZipError or DeflateError depending on the type of inconsistency in data. It may indicate that either the container is damaged or it might not be ZIP container or compressed with Deflate at all.

    Declaration

    Swift

    public static func open(containerData data: Data) throws -> [(entryName: String, entryData: Data)]

    Parameters

    containerData

    Data of ZIP container.

    Return Value

    Array of pairs (tuples) where first member is entryName and second member is entryData.