TAR
-
A type that allows to iteratively read TAR entries from a container provided by a
FileHandle.The
TarReadermay be helpful in reducing the peak memory usage on certain platforms. However, to achieve this either theTarReader.process(_:)function should be used or both the call toTarReader.read()and the processing of the returned entry should be wrapped inside theautoreleasepool. Since theautoreleasepoolis available only on Darwin platforms, the memory reducing effect may be not as significant on non-Darwin platforms (such as Linux or Windows).The following code demonstrates an example usage of the
TarReader:let handle: FileHandle = ... let reader = TarReader(fileHandle: handle) try reader.process { ... } ... try handle.close()Note that closing the
See moreFileHandleremains the responsibility of the caller.Declaration
Swift
public struct TarReader -
A type that allows to iteratively create TAR containers with the output being written into a
FileHandle.The
TarWritermay be helpful in reducing the peak memory usage on certain platforms. However, to achieve this both the creation of TAR entries and the calls toTarWritershould be wrapped inside theautoreleasepool. Since theautoreleasepoolis available only on Darwin platforms, the memory reducing effect may be not as significant on non-Darwin platforms (such as Linux or Windows).The following code demonstrates an example usage of the
TarWriter:let handle: FileHandle = ... let writer = TarWriter(fileHandle: handle) try autoreleasepool { let entry: TarEntry = ... try writer.append(entry) } try writer.finalize() try handle.close()Note that
See moreTarWriter.finalize()must be called after finishing appending entries to the container. In addition, closing theFileHandleremains the responsibility of the caller.Declaration
Swift
public struct TarWriter -
Represents an entry from the TAR container.
See moreDeclaration
Swift
public struct TarEntry : ContainerEntry -
Provides access to information about an entry from the TAR container.
See moreDeclaration
Swift
public struct TarEntryInfo : ContainerEntryInfo
View on GitHub
TAR Reference