GzipArchive

public final class GzipArchive: Archive

Provides unarchive function for GZip archives.

  • Unarchives gzip archive stored in archiveData.

    If data passed is not actually a gzip archive, GzipError will be thrown.

    If data inside the archive is not actually compressed with DEFLATE algorithm, DeflateError will be thrown.

    Note

    This function is specification compliant.

    Throws

    DeflateError or GzipError depending on the type of inconsistency in data. It may indicate that either the data is damaged or it might not be compressed with gzip or DEFLATE at all.

    Declaration

    Swift

    public static func unarchive(archiveData data: Data) throws -> Data

    Parameters

    archiveData

    Data compressed with gzip.

    Return Value

    Unarchived data.

  • Archives data into GZip archive. Data will be also compressed with DEFLTATE algorithm. Fields in the header of the resulting archive will be set to default values (i.e. no mtime, no flags, no file name, unknown OS type). It will be also specified that the compressor used slowest DEFLATE algorithm.

    If during compression something goes wrong DeflateError will be thrown.

    Note

    This function is specification compliant.

    Throws

    DeflateError if an error was encountered during compression.

    Declaration

    Swift

    public static func archive(data: Data) throws -> Data

    Parameters

    data

    Data to compress and archive.

    Return Value

    Data object with resulting archive.