Structure
Header
public struct Header: Codable, Equatable
The cpio
header.
This header is placed directly before the contents of a file in the archive to provide information such as the size of the file, the file's name, it's permissions, etc.
Relationships
Conforms To
Codable
Equatable
Initializers
init(from:)
public init(from decoder: Decoder) throws
Properties
userID
public internal(set) var userID: Int = 0
The ID of the user the file belonged to when it was on the filesystem.
groupID
public internal(set) var groupID: Int = 0
The ID of the group the file belonged to when it was on the filesystem.
modificationTime
public let modificationTime: Int
The last time this file was modified.
Use Int(myDate.timeIntervalSince1970)
to set modificationTime
from a Date
.
inode
public internal(set) var inode: Int?
The inode (index node) of this file. More information is available on Wikipedia.
links
public internal(set) var links: Int = 1
The number of links to this file. Directories always have a value of at least two here. Note that hardlinked files include file data with every copy in the archive.
linkName
public internal(set) var linkName: String?
If this Header
describes a symlink, then linkName
will contain the name of the linked file.
dev
public internal(set) var dev: (major: Int?, minor: Int?) = (nil, nil)
The device number of this file when it was on the filesystem.
rDev
public internal(set) var rDev: (major: Int, minor: Int) = (0, 0)
For block special and character special entries, this field contains the associated device number.
checksum
public internal(set) var checksum: Checksum?
"...[T]he [checksum] field is set to the sum of all bytes in the file data. This sum is computed [by] treating all bytes as unsigned values and using unsigned arithmetic. Only the least-significant 32 bits of the sum are stored."
size
public internal(set) var size: Int = 0
The size of the file.
This variable is only set when reading in an archive header.
Methods
encode(to:)
public func encode(to encoder: Encoder) throws