GzipHeader now checks ftext flag and provides a property for it.

This commit is contained in:
Timofey Solomko
2017-05-25 10:33:16 +03:00
parent e5e7d9f30b
commit 102ba2a3e0
+5 -1
View File
@@ -68,7 +68,7 @@ public struct GzipHeader {
case ntfs = 11
/// File system was unknown to the archiver.
case unknown = 255
/// File system was one of the rare systems..
/// File system was one of the rare systems.
case other = 256
}
@@ -83,6 +83,8 @@ public struct GzipHeader {
/// Comment inside the archive.
public let comment: String?
public let isTextFile: Bool
/**
Initializes the structure with the values of first 'member' in gzip archive presented in `archiveData`.
@@ -128,6 +130,8 @@ public struct GzipHeader {
self.osType = FileSystemType(rawValue: pointerData.alignedByte().toInt()) ?? .other
headerBytes.append(self.osType.rawValue.toUInt8())
self.isTextFile = flags & Flags.ftext != 0
// Some archives may contain extra fields
if flags & Flags.fextra != 0 {
let xlen = pointerData.intFromAlignedBytes(count: 2)