ExpandFile Method  

Expands the contents of a previously specified file.


object.ExpandFile( InputFile, OutputFile, [CompressionType] )


A string value that specifies the name of the file to be expanded. The file must exist, and it must be a file that was created by a previous call to the CompressFile method. An error will be returned if the file cannot be accessed, if it specifies a character device such as the console, or the if the data is not in a recognizable format.
A string value that specifies the name of the file that will contain the expanded data. If the file exists, it must be a regular file that can be opened for writing by the current process and will be overwritten. If the file does not exist, it will be created. An error will be returned if a character device, such as the console, is specified as the file name.
A numeric value which determines the algorithm that was used to compress the data. One of the following values may be specified. If this argument is not specified, the Deflate algorithm is used. If the compression type specified by this argument does not match the actual compression algorithm used to compress the file, an error will be returned.
Value Constant Description
1 fileCompressionDeflate A compression algorithm that combines LZ77 algorithm for creating common substrings and Huffman coding to process the different frequencies of byte sequences in the data stream. Deflate is widely used by compression software.
2 fileCompressionBurrowsWheeler A compression algorithm that rearranges blocks of data in sorted order and then uses Huffman coding to process different frequencies of data within the block. Burrows-Wheeler compression provides a better compression ratio than the Deflate algorithm, however it requires more resources to perform the compression.

Return Value

This method returns a value of zero if the file was successfully decompressed. A non-zero return value specifies an error code which indicates the reason for the failure.


The ExpandFile method expands the contents of a previously compressed file. Note that this method can only expand files that were compressed using the control. It cannot expand the contents of a file stored in an archive format such as PKZip or WinZip.

See Also

CompressFile Method, DecodeFile Method, EncodeFile Method