Class
ZipMutableEntry
public final class ZipMutableEntry: ZipEntry
A read-write accessor for an entry in the archive.
Relationships
Superclass
ZipEntryA read-only accessor for an entry in the archive.
Methods
setExternalAttributes(operatingSystem:attributes:)
public func setExternalAttributes(operatingSystem: ExternalAttributes.OperatingSystem, attributes: UInt32) throws
Sets the operating system and external attributes for the file in the zip archive.
Parameters
| Name | Type | Description |
|---|---|---|
| operatingSystem | ExternalAttributes.OperatingSystem |
operating system value |
| attributes | UInt32 |
external attributes to set |
setExternalAttributes(operatingSystem:posixAttributes:)
public func setExternalAttributes(operatingSystem: ExternalAttributes.OperatingSystem = .unix, posixAttributes: mode_t) throws
Sets the operating system and POSIX attributes to be set as external attributes for the file in the zip archive.
Parameters
| Name | Type | Description |
|---|---|---|
| operatingSystem | ExternalAttributes.OperatingSystem |
operating system value, defaults to |
| posixAttributes | mode_t |
POSIX attributes to be set |
setExtraField(id:index:data:flags:)
public func setExtraField(id: UInt16, index: Int?, data: Data, flags: ExtraFieldFlags) throws
Sets the extra field with ID (two-byte signature) id and index index for the file in the zip archive.
The extra field's data will be set to data. If a new entry shall be appended, set index to nil.
Please note that the extra field IDs 0x0001 (ZIP64 extension), 0x6375 (Infozip UTF-8 comment),
and 0x7075 (Infozip UTF-8 file name) can not be set using setExtraField since they are set
by libzip(3) automatically when needed.
Parameters
| Name | Type | Description |
|---|---|---|
| id | UInt16 |
field ID (two-byte signature) filter |
| index | Int? |
field index to set |
| data | Data |
new field data |
| flags | ExtraFieldFlags |
field lookup flags |
deleteExtraField(index:flags:)
public func deleteExtraField(index: Int?, flags: ExtraFieldFlags) throws
Deletes the extra field with index index for the file in the zip archive.
If index is nil, then all extra fields will be deleted.
Parameters
| Name | Type | Description |
|---|---|---|
| id | field ID (two-byte signature) filter |
|
| index | Int? |
field index to delete |
| flags | ExtraFieldFlags |
field lookup flags |
deleteExtraField(id:index:flags:)
public func deleteExtraField(id: UInt16, index: Int?, flags: ExtraFieldFlags) throws
Deletes the index-s extra field with a specified field ID for the file in the zip archive.
If index is nil, then all extra fields with the specified ID will be deleted.
Parameters
| Name | Type | Description |
|---|---|---|
| id | UInt16 |
field ID (two-byte signature) filter |
| index | Int? |
field index to delete |
| flags | ExtraFieldFlags |
field lookup flags |
setComment(_:)
public func setComment(_ comment: String?) throws
Sets the comment for the file in the zip archive.If comment is set to nil,
the comment is deleted from the archive.
Parameters
| Name | Type | Description |
|---|---|---|
| comment | String? |
new comment string |
setModifiedDate(_:)
public func setModifiedDate(_ date: Date) throws
Sets the last modification time (mtime) for the file in the zip archive to date.
Parameters
| Name | Type | Description |
|---|---|---|
| date | Date |
new file modification time |
setCompression(method:flags:)
public func setCompression(method: ZipStat.CompressionMethod = .default, flags: ZipStat.CompressionFlags = .default) throws
Sets the compression method for the file in the zip archive.
Parameters
| Name | Type | Description |
|---|---|---|
| method | ZipStat.CompressionMethod |
compression method to set |
| flags | ZipStat.CompressionFlags |
compression method specific flags |
setEncryption(method:password:)
public func setEncryption(method: ZipStat.EncryptionMethod, password: String? = nil) throws
Sets the encryption method and password for the file in the zip archive.
If password is nil, the default password provided by ZipArchive.setDefaultPassword is used.
Parameters
| Name | Type | Description |
|---|---|---|
| method | ZipStat.EncryptionMethod |
encryption method to set |
| password | String? |
encryption password |
delete()
public func delete() throws
Marks the file the archive as deleted.
unchange()
public func unchange() throws
Changes to the file are reverted.