Data

struct Data : ReferenceConvertible, Equatable, Hashable, RandomAccessCollection, MutableCollection, RangeReplaceableCollection
  • Whether the data is compressed in gzip format.

    Declaration

    Swift

    public var isGzipped: Bool { get }
  • Create a new Data object by compressing the receiver using zlib. Throws an error if compression failed.

  • level: Compression level.

  • Throws

    GzipError

    Declaration

    Swift

    public func gzipped(level: CompressionLevel = .defaultCompression) throws -> Data

    Return Value

    Gzip-compressed Data object.

  • Create a new Data object by decompressing the receiver using zlib. Throws an error if decompression failed.

    Throws

    GzipError

    Declaration

    Swift

    public func gunzipped() throws -> Data

    Return Value

    Gzip-decompressed Data object.