$decompress

From Scriptwiki
Jump to: navigation, search

Decompresses a file compressed with $compress. Compression is a system used to make a file "smaller" such as zipping. For more information, read up on compression algorithms.

$decompress(file | binary variable,[b]lN)
  • The first parameter is the compressed file or binary variable to be decompressed.
  • The second parameter is a list of option flags
    • b is used to specify a binary variable. If you are using a file name and not a binary variable, do not specify the b flag.
    • lN is the compression level, where N is a number from one (1) to six (6).
  • Returns: 1 if the decompression was successful, 0 if it was not.

Note: The identifier does not return the compressed data, it returns 0 or 1 based on success for use in If-Then-Else statements.

Example

alias compressFile {
 if ($compress($1-,l6)) { echo -atg $1- was successfully compressed with the highest compression level, level 6. }
 else { echo -atg Compression of $1- failed. }
}
alias decompressFile {
 if ($decompress($1-,l6)) { echo -atg $1- was successfully decompressed from the highest compression level, level 6. }
 else { echo -atg Decompression of $1- failed. }
}

See Also