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.
decompressFile
fn
void 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
inputPath | Path to the compressed input file. |
outputPath | Path to the output file where decompressed data will be written. |
opts | Decompression options including format. Defaults to DecompressionOptions.init if not specified. |
providerName | Optional 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,
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); ---