decompressFile

fnvoid decompressFile(string inputPath, string outputPath, DecompressionOptions opts = DecompressionOptions.init, string providerName = null)

Decompress a file to another file.

Reads compressed data from the input file, decompresses it using the specified decompression options, and writes the decompressed data to the output file.

This is a convenience function that handles file I/O and streaming internally. For more control over the decompression process, use the streaming API directly.

Parameters

inputPathPath to the compressed input file.
outputPathPath to the output file where decompressed data will be written.
optsDecompression options including format. Defaults to DecompressionOptions.init if not specified.
providerNameOptional name of the decompression provider to use. If null, the highest-priority provider for the format is used.

Throws

CompressionError if no provider is registered for the specified format,

if the input data is corrupted, or if a decompression error occurs. FileException if the input file cannot be opened or the output file cannot be created.

Examples

---

// Decompress a GZIP file decompressFile("data.txt.gz", "data.txt", DecompressionOptions(CompressionFormat.GZIP));

// Decompress with auto-detection auto opts = DecompressionOptions.init; opts.autoDetectFormat = true; decompressFile("data.txt.gz", "data.txt", opts); ---