diff --git a/Sources/ZipContainer.swift b/Sources/ZipContainer.swift index 5297fc0c..48666f93 100644 --- a/Sources/ZipContainer.swift +++ b/Sources/ZipContainer.swift @@ -58,7 +58,7 @@ public class ZipEntry: ContainerEntry { private var pointerData: DataWithPointer /// Name of the file or directory. - public var name: String? { + public var name: String { return self.cdEntry.fileName } @@ -72,6 +72,14 @@ public class ZipEntry: ContainerEntry { return self.cdEntry.externalFileAttributes } + public var size: Int { + return Int(truncatingBitPattern: cdEntry.uncompSize) + } + + public var isDirectory: Bool { + return false // TODO: Implement. + } + /** Returns data associated with this entry. @@ -396,7 +404,7 @@ struct CentralDirectoryEntry { } } - guard let fileComment = String(data: Data(bytes: pointerData.alignedBytes(count: fileNameLength)), + guard let fileComment = String(data: Data(bytes: pointerData.alignedBytes(count: fileCommentLength)), encoding: .utf8) else { throw ZipError.wrongTextField } self.fileComment = fileComment