DecodeFile Method  
 

Decode the contents of the specified file.

Syntax

object.DecodeFile( InputFile, OutputFile, Encoding )

Parameters

InputFile
A string value that specifies the name of the file to be decoded. The file must exist, and it must be a regular file that can be opened for reading by the current process. An error will be returned if a character device, such as the console, is specified as the file name.
OutputFile
A string value that specifies the name of the file that will contain the decoded 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.
Encoding
The encoding algorithm that was used to create the file. The following encoding algorithms are valid:
Value Description
fileDecodeDefault Use the default encoding method. Currently this is the same specifying that the base64 algorithm should be used for encoding and decoding files.
fileDecodeBase64 Use the Base64 algorithm, a widely supported method for encoding binary data as text. It is the standard used by most modern email clients and web applications. This is the default encoding algorithm and should be used by most applications.
fileDecodeQuoted Use the quoted-printable encoding scheme, which encodes only non-printable characters. Often used in email messages to preserve text readability while ensuring compatibility. This algorithm should only be used when the content is primarily text which may include some 8-bit characters. Do not use this algorithm to encode large amounts of binary data.
fileDecodeUucode Use the uuencode algorithm, a legacy encoding format traditionally used on UNIX systems and in early email software. This option is primarily included for compatibility with older applications. This algorithm should not be used with new applications.
fileDecodeYencode Use the yEnc algorithm, a compact encoding method commonly used for binary file attachments in Usenet newsgroups. It offers higher efficiency than traditional uuencode or Base64. This algorithm is primarily used with USENET newsgroups.
fileDecodeBase58 Use the Base58 algorithm, which produces a compact, human-readable encoded string. Commonly used for short binary identifiers such as cryptocurrency addresses. This algorithm should not be used with large files. Refer to the remarks below for more information about Base58.
fileDecodeBase32 Use the Base32 algorithm, which encodes binary data into a limited set of 32 alphanumeric characters. Commonly used in systems where case-insensitive encoding is required or where data may be transcribed manually. See remarks below for more details about Base32.
fileDecodeBase85 Use the Base85 algorithm, which encodes binary data into a more compact form than Base64. Useful when file size reduction is critical and full ASCII compatibility is required. See remarks below for more details about Base85.
fileDecodeCompressed This option is used in combination with one of the encoding types listed above. If specified, the method will decode the file and expand the data, restoring the original file contents.

Return Value

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

Remarks

The DecodeFile method decodes the contents of a file that was created using the specified encoding method. The fileDecodeCompressed option should only be specified if the encoded file was created using EncodeFile method with the fileEncodeCompressed option.

If you wish to convert the contents of a text file to a different Unicode encoding, use the ConvertFile method.

See Also

Encoding Property, CompareFile Method, CompressFile Method, ConvertFile Method, EncodeFile Method, ExpandFile Method