Script Library: 1213 scripts
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 
View scriptLicenseDownload documentation as: HTML or editable
Download scriptHistoryOther scripts by: vincentecuye

Documentation for: gzip.r


REBOL

gzip

Author: Vincent Ecuyer
Date: 4-Feb-2013
File: %gzip.r

Contents:

1. Purpose
2. Usage
3. Examples
4. Comment

1. Purpose

Creates gzip archives, using the rebol compress command.

2. Usage

Compresses a string series into a gzip encoding, and returns the binary result.

gzip data /name file
  • data (any-string! binary!) - Data to compress.
  • /name - Specifies a filename. (optional : default filename is the same as the archive's without the .gz extension)
  • file (with /name) - The filename to use in archive.

3. Examples

REBOL 2:

my-data: #{........}
write/binary %test.gz gzip/name my-data %my-file.txt

REBOL 3:

my-data: #{........} 
write %test.gz gzip/name my-data %my-file.txt

4. Comment

COMPRESS uses a zlib compatible format - always with deflate algorithm, 32k window size, max compression and no dictionary - followed by checksum (4 bytes) and uncompressed data length (4 bytes).

For REBOL 2.x, this module uses a precalculated crc table, and for REBOL 3.x, it uses the available 'crc32 checksum method - r3 compress/gzip is bugged (wrong checksum), so it isn't used.

MakeDoc2 by REBOL- 4-Feb-2013