Data
extension Data
-
Whether the receiver is compressed in gzip format.
Declaration
Swift
public var isGzipped: Bool
-
Create a new
Data
instance by compressing the receiver using zlib. Throws an error if compression failed.The
wBits
parameter allows for managing the size of the history buffer. The possible values are:Value Window size logarithm Input +9 to +15 Base 2 Includes zlib header and trailer -9 to -15 Absolute value of wbits No header and trailer +25 to +31 Low 4 bits of the value Includes gzip header and trailing checksum
Throws
GzipError
Declaration
Swift
public func gzipped(level: CompressionLevel = .defaultCompression, wBits: Int32 = GzipStatics.maxWindowBits + 16) throws -> Data
Parameters
level
Compression level.
wBits
Manage the size of the history buffer.
Return Value
Gzip-compressed
Data
instance. -
Create a new
Data
instance by decompressing the receiver using zlib. Throws an error if decompression failed.The
wBits
parameter allows for managing the size of the history buffer. The possible values are:Value Window size logarithm Input +8 to +15 Base 2 Includes zlib header and trailer -8 to -15 Absolute value of wbits Raw stream with no header and trailer +24 to +31 = 16 + (8 to 15) Low 4 bits of the value Includes gzip header and trailer +40 to +47 = 32 + (8 to 15) Low 4 bits of the value zlib or gzip format
Throws
GzipError
Declaration
Swift
public func gunzipped(wBits: Int32 = GzipStatics.maxWindowBits + 32) throws -> Data
Parameters
wBits
Manage the size of the history buffer.
Return Value
Gzip-decompressed
Data
instance.