ArArchiveKit Documentation

Structure ArArchive​Reader

public struct ArArchiveReader  

ArArchiveReader reads ar files.

let archiveData: Data = ...
let reader = ArArchiveReader(archive: Array(archiveData))

print("Name: \(reader.headers[0])")
print("Contents:\n \(String(reader[0]))")
%21 ArArchiveReader ArArchiveReader Sequence Sequence ArArchiveReader->Sequence

Conforms To

Sequence

Initializers

init(archive:​)

public init(archive: [UInt8]) throws  

The initializer reads all the ar headers in preparation for random access to the header's file contents later.

Parameters

archive [UInt8]

The bytes of the archive you want to read.

Throws

ArArchiveError.

Properties

headers

public var headers: [Header] = [] 

The headers that describe the files in this archive.

Use this to find a file in the archive, then use the provided subscript to get the bytes of the file.

let bytes = Array<UInt8>(try Data(contentsOf: myURL))
let reader = try ArArchiveReader(archive: bytes)
let bytes = reader[header: reader.headers[0]]
// Use bytes...

count

public var count: Int  

The amount of files in this archive.

variant

public private(set) var variant: Variant

The Variant of this archive.

Methods

make​Iterator()

public func makeIterator() -> ArArchiveReaderIterator