$compress

From Scriptwiki
Jump to: navigation, search

Compresses a file to be decompressed with $decompress. Compression is a system used to make a file "smaller" such as zipping. For more information, read up on compression algorithms.

$compress(file | binary variable,[b]lN)
  • The first parameter is the file or binary variable to be compressed.
  • 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 compression was successful, 0 if it was not.

Note: The identifier does not return the decompressed 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