createCompressedArchive

fnArchiveWriter createCompressedArchive(string path, ArchiveFormat archiveFormat, CompressionFormat compressionFormat, WriteOptions opts = WriteOptions.init)

Create a compressed archive (e.g., .tar.gz).

Creates an archive writer that buffers the archive output and compresses it before writing to the file. The returned writer behaves like a normal ArchiveWriter; compression happens automatically when finish() or close() is called.

Parameters

pathOutput file path.
archiveFormatThe archive format (e.g., TAR).
compressionFormatThe compression format (e.g., GZIP).
optsAdditional write options.

Returns

An ArchiveWriter that produces a compressed archive.

Throws

ArchiveError if parameters are invalid or no provider is registered.
fnArchiveWriter createCompressedArchive(ContentSink sink, ArchiveFormat archiveFormat, CompressionFormat compressionFormat, WriteOptions opts = WriteOptions.init)

Create a compressed archive writing to a ContentSink.

Creates an archive writer that buffers the archive output and compresses it before writing to the sink. The returned writer behaves like a normal ArchiveWriter; compression happens automatically when finish() or close() is called.

Parameters

sinkOutput sink that receives the compressed archive bytes.
archiveFormatThe archive format (e.g., TAR).
compressionFormatThe compression format (e.g., GZIP).
optsAdditional write options.

Returns

An ArchiveWriter that produces a compressed archive via the sink.

Throws

ArchiveError if parameters are invalid or no provider is registered.