ZipContainer
public class ZipContainer: Container
Provides function which opens ZIP archives (containers).
-
Processes ZIP archive (container) and returns an array of
ContainerEntries(which are actuallyZipEntries). 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.
Throws
ZipErroror any other error associated with compression type, depending on the type of inconsistency in data. It may indicate that either the container is damaged or it might not be ZIP container at all.Declaration
Swift
public static func open(containerData: Data) throws -> [ContainerEntry]Parameters
containerDataData of ZIP container.
Return Value
Array of pairs
ZipEntriesas an array ofContainerEntries.
View on GitHub
ZipContainer Class Reference