{"id":6323,"date":"2022-12-20T18:58:09","date_gmt":"2022-12-20T21:58:09","guid":{"rendered":"http:\/\/lode.uno\/linux-man\/index.php\/2022\/12\/20\/zlib-mann\/"},"modified":"2022-12-20T18:58:09","modified_gmt":"2022-12-20T21:58:09","slug":"zlib-mann","status":"publish","type":"post","link":"https:\/\/lode.uno\/linux-man\/2022\/12\/20\/zlib-mann\/","title":{"rendered":"zlib (mann)"},"content":{"rendered":"<h1 align=\"center\">zlib<\/h1>\n<p> <a href=\"#NAME\">NAME<\/a><br \/> <a href=\"#SYNOPSIS\">SYNOPSIS<\/a><br \/> <a href=\"#DESCRIPTION\">DESCRIPTION<\/a><br \/> <a href=\"#STREAMING INSTANCE COMMAND\">STREAMING INSTANCE COMMAND<\/a><br \/> <a href=\"#EXAMPLES\">EXAMPLES<\/a><br \/> <a href=\"#SEE ALSO\">SEE ALSO<\/a><br \/> <a href=\"#KEYWORDS\">KEYWORDS<\/a> <\/p>\n<hr>\n<p>______________________________________________________________________________<\/p>\n<h2>NAME <a name=\"NAME\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">zlib \u2212 compression and decompression operations<\/p>\n<h2>SYNOPSIS <a name=\"SYNOPSIS\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>zlib<\/b> <i>subcommand arg &#8230;<\/i> ______________________________________________________________________________<\/p>\n<h2>DESCRIPTION <a name=\"DESCRIPTION\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">The <b>zlib<\/b> command provides access to the compression and check-summing facilities of the Zlib library by Jean-loup Gailly and Mark Adler. It has the following subcommands.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>COMPRESSION SUBCOMMANDS <br \/> zlib compress<\/b> <i>string<\/i> ?<i>level<\/i>?<\/p>\n<p style=\"margin-left:22%;\">Returns the zlib-format compressed binary data of the binary string in <i>string<\/i>. If present, <i>level<\/i> gives the compression level to use (from 0, which is uncompressed, to 9, maximally compressed).<\/p>\n<p style=\"margin-left:11%;\"><b>zlib decompress<\/b> <i>string<\/i> ?<i>bufferSize<\/i>?<\/p>\n<p style=\"margin-left:22%;\">Returns the uncompressed version of the raw compressed binary data in <i>string<\/i>. If present, <i>bufferSize<\/i> is a hint as to what size of buffer is to be used to receive the data.<\/p>\n<p style=\"margin-left:11%;\"><b>zlib deflate<\/b> <i>string<\/i> ?<i>level<\/i>?<\/p>\n<p style=\"margin-left:22%;\">Returns the raw compressed binary data of the binary string in <i>string<\/i>. If present, <i>level<\/i> gives the compression level to use (from 0, which is uncompressed, to 9, maximally compressed).<\/p>\n<p style=\"margin-left:11%;\"><b>zlib gunzip<\/b> <i>string<\/i> ?<b>\u2212headerVar<\/b> <i>varName<\/i>?<\/p>\n<p style=\"margin-left:22%;\">Return the uncompressed contents of binary string <i>string<\/i>, which must have been in gzip format. If <b>\u2212headerVar<\/b> is given, store a dictionary describing the contents of the gzip header in the variable called <i>varName<\/i>. The keys of the dictionary that may be present are: <b><br \/> comment<\/b><\/p>\n<p style=\"margin-left:32%;\">The comment field from the header, if present.<\/p>\n<table width=\"100%\" border=\"0\" rules=\"none\" frame=\"void\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"22%\"><\/td>\n<td width=\"4%\">\n<p><b>crc<\/b><\/p>\n<\/td>\n<td width=\"6%\"><\/td>\n<td width=\"68%\">\n<p>A boolean value describing whether a CRC of the header is computed.<\/p>\n<\/td>\n<\/tr>\n<\/table>\n<p style=\"margin-left:22%;\"><b>filename<\/b><\/p>\n<p style=\"margin-left:32%;\">The filename field from the header, if present.<\/p>\n<table width=\"100%\" border=\"0\" rules=\"none\" frame=\"void\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"22%\"><\/td>\n<td width=\"6%\">\n<p><b>os<\/b><\/p>\n<\/td>\n<td width=\"4%\"><\/td>\n<td width=\"68%\">\n<p>The operating system type code field from the header (if not the QW unknown value). See RFC 1952 for the meaning of these codes.<\/p>\n<\/td>\n<\/tr>\n<tr valign=\"top\" align=\"left\">\n<td width=\"22%\"><\/td>\n<td width=\"6%\">\n<p><b>size<\/b><\/p>\n<\/td>\n<td width=\"4%\"><\/td>\n<td width=\"68%\">\n<p>The size of the uncompressed data.<\/p>\n<\/td>\n<\/tr>\n<tr valign=\"top\" align=\"left\">\n<td width=\"22%\"><\/td>\n<td width=\"6%\">\n<p><b>time<\/b><\/p>\n<\/td>\n<td width=\"4%\"><\/td>\n<td width=\"68%\">\n<p>The time field from the header if non-zero, expected to be time that the file named by the <b>filename<\/b> field was modified. Suitable for use with <b>clock format<\/b>.<\/p>\n<\/td>\n<\/tr>\n<tr valign=\"top\" align=\"left\">\n<td width=\"22%\"><\/td>\n<td width=\"6%\">\n<p><b>type<\/b><\/p>\n<\/td>\n<td width=\"4%\"><\/td>\n<td width=\"68%\">\n<p>The type of the uncompressed data (<b>binary<\/b> or <b>text<\/b>) if known.<\/p>\n<\/td>\n<\/tr>\n<\/table>\n<p style=\"margin-left:11%;\"><b>zlib gzip<\/b> <i>string<\/i> ?<b>\u2212level<\/b> <i>level<\/i>? ?<b>\u2212header<\/b> <i>dict<\/i>?<\/p>\n<p style=\"margin-left:22%;\">Return the compressed contents of binary string <i>string<\/i> in gzip format. If <b>\u2212level<\/b> is given, <i>level<\/i> gives the compression level to use (from 0, which is uncompressed, to 9, maximally compressed). If <b>\u2212header<\/b> is given, <i>dict<\/i> is a dictionary containing values used for the gzip header. The following keys may be defined: <b><br \/> comment<\/b><\/p>\n<p style=\"margin-left:32%;\">Add the given comment to the header of the gzip-format data.<\/p>\n<table width=\"100%\" border=\"0\" rules=\"none\" frame=\"void\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"22%\"><\/td>\n<td width=\"4%\">\n<p><b>crc<\/b><\/p>\n<\/td>\n<td width=\"6%\"><\/td>\n<td width=\"68%\">\n<p>A boolean saying whether to compute a CRC of the header. Note that if the data is to be interchanged with the <b>gzip<\/b> program, a header CRC should <i>not<\/i> be computed.<\/p>\n<\/td>\n<\/tr>\n<\/table>\n<p style=\"margin-left:22%;\"><b>filename<\/b><\/p>\n<p style=\"margin-left:32%;\">The name of the file that the data to be compressed came from.<\/p>\n<table width=\"100%\" border=\"0\" rules=\"none\" frame=\"void\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"22%\"><\/td>\n<td width=\"6%\">\n<p><b>os<\/b><\/p>\n<\/td>\n<td width=\"4%\"><\/td>\n<td width=\"68%\">\n<p>The operating system type code, which should be one of the values described in RFC 1952.<\/p>\n<\/td>\n<\/tr>\n<tr valign=\"top\" align=\"left\">\n<td width=\"22%\"><\/td>\n<td width=\"6%\">\n<p><b>time<\/b><\/p>\n<\/td>\n<td width=\"4%\"><\/td>\n<td width=\"68%\">\n<p>The time that the file named in the <b>filename<\/b> key was last modified. This will be in the same as is returned by <b>clock seconds<\/b> or <b>file mtime<\/b>.<\/p>\n<\/td>\n<\/tr>\n<tr valign=\"top\" align=\"left\">\n<td width=\"22%\"><\/td>\n<td width=\"6%\">\n<p><b>type<\/b><\/p>\n<\/td>\n<td width=\"4%\"><\/td>\n<td width=\"68%\">\n<p>The type of the data being compressed, being <b>binary<\/b> or <b>text<\/b>.<\/p>\n<\/td>\n<\/tr>\n<\/table>\n<p style=\"margin-left:11%;\"><b>zlib inflate<\/b> <i>string<\/i> ?<i>bufferSize<\/i>?<\/p>\n<p style=\"margin-left:22%;\">Returns the uncompressed version of the raw compressed binary data in <i>string<\/i>. If present, <i>bufferSize<\/i> is a hint as to what size of buffer is to be used to receive the data.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>CHANNEL SUBCOMMAND <br \/> zlib push<\/b> <i>mode channel<\/i> ?<i>options &#8230;<\/i>?<\/p>\n<p style=\"margin-left:22%;\">Pushes a compressing or decompressing transformation onto the channel <i>channel<\/i>. The transformation can be removed again with <b>chan pop<\/b>. The <i>mode<\/i> argument determines what type of transformation is pushed; the following are supported: <b><br \/> compress<\/b><\/p>\n<p style=\"margin-left:32%;\">The transformation will be a compressing transformation that produces zlib-format data on <i>channel<\/i>, which must be writable.<\/p>\n<p style=\"margin-left:22%;\"><b>decompress<\/b><\/p>\n<p style=\"margin-left:32%;\">The transformation will be a decompressing transformation that reads zlib-format data from <i>channel<\/i>, which must be readable.<\/p>\n<p style=\"margin-left:22%;\"><b>deflate<\/b><\/p>\n<p style=\"margin-left:32%;\">The transformation will be a compressing transformation that produces raw compressed data on <i>channel<\/i>, which must be writable.<\/p>\n<table width=\"100%\" border=\"0\" rules=\"none\" frame=\"void\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"22%\"><\/td>\n<td width=\"9%\">\n<p><b>gunzip<\/b><\/p>\n<\/td>\n<td width=\"1%\"><\/td>\n<td width=\"68%\">\n<p>The transformation will be a decompressing transformation that reads gzip-format data from <i>channel<\/i>, which must be readable.<\/p>\n<\/td>\n<\/tr>\n<tr valign=\"top\" align=\"left\">\n<td width=\"22%\"><\/td>\n<td width=\"9%\">\n<p><b>gzip<\/b><\/p>\n<\/td>\n<td width=\"1%\"><\/td>\n<td width=\"68%\">\n<p>The transformation will be a compressing transformation that produces gzip-format data on <i>channel<\/i>, which must be writable.<\/p>\n<\/td>\n<\/tr>\n<\/table>\n<p style=\"margin-left:22%;\"><b>inflate<\/b><\/p>\n<p style=\"margin-left:32%;\">The transformation will be a decompressing transformation that reads raw compressed data from <i>channel<\/i>, which must be readable.<\/p>\n<p style=\"margin-left:22%; margin-top: 1em\">The following options may be set when creating a transformation via the \u201c<i>options &#8230;<\/i>\u201d to the <b>zlib push<\/b> command: <b><br \/> \u2212dictionary<\/b> <i>binData<\/i><\/p>\n<p style=\"margin-left:32%;\">Sets the compression dictionary to use when working with <big>\u2502<\/big> compressing or decompressing the data to be <i>binData<\/i>. Not <big>\u2502<\/big> valid for transformations that work with gzip-format <big>\u2502<\/big> data. The dictionary should consist of strings (byte <big>\u2502<\/big> sequences) that are likely to be encountered later in the <big>\u2502<\/big> data to be compressed, with the most commonly used <big>\u2502<\/big> strings preferably put towards the end of the dictionary. <big>\u2502<\/big> Tcl provides no mechanism for choosing a good such <big>\u2502<\/big> dictionary for a particular data sequence.<\/p>\n<p style=\"margin-left:22%;\"><b>\u2212header<\/b> <i>dictionary<\/i><\/p>\n<p style=\"margin-left:32%;\">Passes a description of the gzip header to create, in the same format that <b>zlib gzip<\/b> understands.<\/p>\n<p style=\"margin-left:22%;\"><b>\u2212level<\/b> <i>compressionLevel<\/i><\/p>\n<p style=\"margin-left:32%;\">How hard to compress the data. Must be an integer from 0 (uncompressed) to 9 (maximally compressed).<\/p>\n<p style=\"margin-left:22%;\"><b>\u2212limit<\/b> <i>readaheadLimit<\/i><\/p>\n<p style=\"margin-left:32%;\">The maximum number of bytes ahead to read when decompressing. This defaults to 1, which ensures that data is always decompressed correctly, but may be increased to improve performance. This is more useful when the channel is non-blocking.<\/p>\n<p style=\"margin-left:22%; margin-top: 1em\">Both compressing and decompressing channel transformations add extra configuration options that may be accessed through <b>chan configure<\/b>. The options are: <b><br \/> \u2212checksum<\/b> <i>checksum<\/i><\/p>\n<p style=\"margin-left:32%;\">This read-only option gets the current checksum for the uncompressed data that the compression engine has seen so far. It is valid for both compressing and decompressing transforms, but not for the raw inflate and deflate formats. The compression algorithm depends on what format is being produced or consumed.<\/p>\n<p style=\"margin-left:22%;\"><b>\u2212dictionary<\/b> <i>binData<\/i><\/p>\n<p style=\"margin-left:32%;\">This read-write options gets or sets the initial <big>\u2502<\/big> compression dictionary to use when working with <big>\u2502<\/big> compressing or decompressing the data to be <i>binData<\/i>. It <big>\u2502<\/big> is not valid for transformations that work with <big>\u2502<\/big> gzip-format data, and should not normally be set on <big>\u2502<\/big> compressing transformations other than at the point where <big>\u2502<\/big> the transformation is stacked. Note that this cannot be <big>\u2502<\/big> used to get the current active compression dictionary <big>\u2502<\/big> mid-stream, as that information is not exposed by the <big>\u2502<\/big> underlying library.<\/p>\n<p style=\"margin-left:22%;\"><b>\u2212flush<\/b> <i>type<\/i><\/p>\n<p style=\"margin-left:32%;\">This write-only operation flushes the current state of the compressor to the underlying channel. It is only valid for compressing transformations. The <i>type<\/i> must be either <b>sync<\/b> or <b>full<\/b> for a normal flush or an expensive flush respectively. Flushing degrades the compression ratio, but makes it easier for a decompressor to recover more of the file in the case of data corruption.<\/p>\n<p style=\"margin-left:22%;\"><b>\u2212header<\/b> <i>dictionary<\/i><\/p>\n<p style=\"margin-left:32%;\">This read-only option, only valid for decompressing transforms that are processing gzip-format data, returns the dictionary describing the header read off the data stream.<\/p>\n<p style=\"margin-left:22%;\"><b>\u2212limit<\/b> <i>readaheadLimit<\/i><\/p>\n<p style=\"margin-left:32%;\">This read-write option is used by decompressing channels to control the maximum number of bytes ahead to read from the underlying data source. This defaults to 1, which ensures that data is always decompressed correctly, but may be increased to improve performance. This is more useful when the channel is non-blocking.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>STREAMING SUBCOMMAND <br \/> zlib stream<\/b> <i>mode<\/i> ?<i>options<\/i>?<\/p>\n<p style=\"margin-left:22%;\">Creates a streaming compression or decompression command based on the <i>mode<\/i>, and return the name of the command. For a description of how that command works, see <b>STREAMING INSTANCE COMMAND<\/b> below. The following modes and <i>options<\/i> are supported: <b><br \/> zlib stream compress<\/b> ?<b>\u2212dictionary<\/b> <i>bindata<\/i>? ?<b>\u2212level<\/b> <i>level<\/i>?<\/p>\n<p style=\"margin-left:32%;\">The stream will be a compressing stream that produces zlib-format output, using compression level <i>level<\/i> (if specified) which will be an integer from 0 to 9, and the <big>\u2502<\/big> compression dictionary <i>bindata<\/i> (if specified).<\/p>\n<p style=\"margin-left:22%;\"><b>zlib stream decompress<\/b> ?<b>\u2212dictionary<\/b> <i>bindata<\/i>?<\/p>\n<p style=\"margin-left:32%;\">The stream will be a decompressing stream that takes zlib-format input and produces uncompressed output. If <big>\u2502<\/big> <i>bindata<\/i> is supplied, it is a compression dictionary to <big>\u2502<\/big> use if required.<\/p>\n<p style=\"margin-left:22%;\"><b>zlib stream deflate<\/b> ?<b>\u2212dictionary<\/b> <i>bindata<\/i>? ?<b>\u2212level<\/b> <i>level<\/i>?<\/p>\n<p style=\"margin-left:32%;\">The stream will be a compressing stream that produces raw output, using compression level <i>level<\/i> (if specified) which will be an integer from 0 to 9, and the compression <big>\u2502<\/big> dictionary <i>bindata<\/i> (if specified). Note that the raw <big>\u2502<\/big> compressed data includes no metadata about what <big>\u2502<\/big> compression dictionary was used, if any; that is a <big>\u2502<\/big> feature of the zlib-format data.<\/p>\n<p style=\"margin-left:22%;\"><b>zlib stream gunzip<\/b><\/p>\n<p style=\"margin-left:32%;\">The stream will be a decompressing stream that takes gzip-format input and produces uncompressed output.<\/p>\n<p style=\"margin-left:22%;\"><b>zlib stream gzip<\/b> ?<b>\u2212header<\/b> <i>header<\/i>? ?<b>\u2212level<\/b> <i>level<\/i>?<\/p>\n<p style=\"margin-left:32%;\">The stream will be a compressing stream that produces gzip-format output, using compression level <i>level<\/i> (if specified) which will be an integer from 0 to 9, and the header descriptor dictionary <i>header<\/i> (if specified; for keys see <b>zlib gzip<\/b>).<\/p>\n<p style=\"margin-left:22%;\"><b>zlib stream inflate<\/b> ?<b>\u2212dictionary<\/b> <i>bindata<\/i>?<\/p>\n<p style=\"margin-left:32%;\">The stream will be a decompressing stream that takes raw compressed input and produces uncompressed output. If <big>\u2502<\/big> <i>bindata<\/i> is supplied, it is a compression dictionary to <big>\u2502<\/big> use. Note that there are no checks in place to determine <big>\u2502<\/big> whether the compression dictionary is correct.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>CHECKSUMMING SUBCOMMANDS <br \/> zlib adler32<\/b> <i>string<\/i> ?<i>initValue<\/i>?<\/p>\n<p style=\"margin-left:22%;\">Compute a checksum of binary string <i>string<\/i> using the Adler-32 algorithm. If given, <i>initValue<\/i> is used to initialize the checksum engine.<\/p>\n<p style=\"margin-left:11%;\"><b>zlib crc32<\/b> <i>string<\/i> ?<i>initValue<\/i>?<\/p>\n<p style=\"margin-left:22%;\">Compute a checksum of binary string <i>string<\/i> using the CRC-32 algorithm. If given, <i>initValue<\/i> is used to initialize the checksum engine.<\/p>\n<h2>STREAMING INSTANCE COMMAND <a name=\"STREAMING INSTANCE COMMAND\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">Streaming compression instance commands are produced by the <b>zlib stream<\/b> command. They are used by calling their <b>put<\/b> subcommand one or more times to load data in, and their <b>get<\/b> subcommand one or more times to extract the transformed data.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">The full set of subcommands supported by a streaming instance command, <i>stream<\/i>, is as follows: <i><br \/> stream<\/i> <b>add<\/b> ?<i>option&#8230;<\/i>? <i>data<\/i><\/p>\n<p style=\"margin-left:22%;\">A short-cut for \u201c<i>stream<\/i> <b>put<\/b> ?<i>option&#8230;<\/i>? <i>data<\/i>\u201d followed by \u201c<i>stream<\/i> <b>get<\/b>\u201d.<\/p>\n<p style=\"margin-left:11%;\"><i>stream<\/i> <b>checksum<\/b><\/p>\n<p style=\"margin-left:22%;\">Returns the checksum of the uncompressed data seen so far by this stream.<\/p>\n<p style=\"margin-left:11%;\"><i>stream<\/i> <b>close<\/b><\/p>\n<p style=\"margin-left:22%;\">Deletes this stream and frees up all resources associated with it.<\/p>\n<p style=\"margin-left:11%;\"><i>stream<\/i> <b>eof<\/b><\/p>\n<p style=\"margin-left:22%;\">Returns a boolean indicating whether the end of the stream (as determined by the compressed data itself) has been reached. Not all formats support detection of the end of the stream.<\/p>\n<p style=\"margin-left:11%;\"><i>stream<\/i> <b>finalize<\/b><\/p>\n<p style=\"margin-left:22%;\">A short-cut for \u201c<i>stream<\/i> <b>put \u2212finalize {}<\/b>\u201d.<\/p>\n<p style=\"margin-left:11%;\"><i>stream<\/i> <b>flush<\/b><\/p>\n<p style=\"margin-left:22%;\">A short-cut for \u201c<i>stream<\/i> <b>put \u2212flush {}<\/b>\u201d.<\/p>\n<p style=\"margin-left:11%;\"><i>stream<\/i> <b>fullflush<\/b><\/p>\n<p style=\"margin-left:22%;\">A short-cut for \u201c<i>stream<\/i> <b>put \u2212fullflush {}<\/b>\u201d.<\/p>\n<p style=\"margin-left:11%;\"><i>stream<\/i> <b>get<\/b> ?<i>count<\/i>?<\/p>\n<p style=\"margin-left:22%;\">Return up to <i>count<\/i> bytes from <i>stream<\/i>\u2019s internal buffers with the transformation applied. If <i>count<\/i> is omitted, the entire contents of the buffers are returned. <i>stream<\/i> <b>header<\/b> Return the gzip header description dictionary extracted from the stream. Only supported for streams created with their <i>mode<\/i> parameter set to <b>gunzip<\/b>.<\/p>\n<p style=\"margin-left:11%;\"><i>stream<\/i> <b>put<\/b> ?<i>option&#8230;<\/i>? <i>data<\/i><\/p>\n<p style=\"margin-left:22%;\">Append the contents of the binary string <i>data<\/i> to <i>stream<\/i>\u2019s internal buffers while applying the transformation. The following <i>option<\/i>s are supported (or an unambiguous prefix of them), which are used to modify the way in which the transformation is applied: <b><br \/> \u2212dictionary<\/b> <i>binData<\/i><\/p>\n<p style=\"margin-left:32%;\">Sets the compression dictionary to use when working with <big>\u2502<\/big> compressing or decompressing the data to be <i>binData<\/i>.<\/p>\n<p style=\"margin-left:22%;\"><b>\u2212finalize<\/b><\/p>\n<p style=\"margin-left:32%;\">Mark the stream as finished, ensuring that all bytes have been wholly compressed or decompressed. For gzip streams, this also ensures that the footer is written to the stream. The stream will need to be reset before having more data written to it after this, though data can still be read out of the stream with the <b>get<\/b> subcommand.<\/p>\n<p style=\"margin-left:32%; margin-top: 1em\">This option is mutually exclusive with the <b>\u2212flush<\/b> and <b>\u2212fullflush<\/b> options.<\/p>\n<table width=\"100%\" border=\"0\" rules=\"none\" frame=\"void\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"22%\"><\/td>\n<td width=\"9%\">\n<p><b>\u2212flush<\/b><\/p>\n<\/td>\n<td width=\"1%\"><\/td>\n<td width=\"68%\">\n<p>Ensure that a decompressor consuming the bytes that the current (compressing) stream is producing will be able to produce all the bytes that have been compressed so far, at some performance penalty.<\/p>\n<\/td>\n<\/tr>\n<\/table>\n<p style=\"margin-left:32%; margin-top: 1em\">This option is mutually exclusive with the <b>\u2212finalize<\/b> and <b>\u2212fullflush<\/b> options.<\/p>\n<p style=\"margin-left:22%;\"><b>\u2212fullflush<\/b><\/p>\n<p style=\"margin-left:32%;\">Ensure that not only can a decompressor handle all the bytes produced so far (as with <b>\u2212flush<\/b> above) but also that it can restart from this point if it detects that the stream is partially corrupt. This incurs a substantial performance penalty.<\/p>\n<p style=\"margin-left:32%; margin-top: 1em\">This option is mutually exclusive with the <b>\u2212finalize<\/b> and <b>\u2212flush<\/b> options.<\/p>\n<p style=\"margin-left:11%;\"><i>stream<\/i> <b>reset<\/b><\/p>\n<p style=\"margin-left:22%;\">Puts any stream, including those that have been finalized or that have reached eof, back into a state where it can process more data. Throws away all internally buffered data.<\/p>\n<h2>EXAMPLES <a name=\"EXAMPLES\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">To compress a Tcl string, it should be first converted to a particular charset encoding since the <b>zlib<\/b> command always operates on binary strings.<\/p>\n<p style=\"margin-left:22%; margin-top: 1em\">set binData [encoding convertto utf-8 $string] <br \/> set compData [<b>zlib compress<\/b> $binData]<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">When converting back, it is also important to reverse the charset encoding:<\/p>\n<p style=\"margin-left:22%; margin-top: 1em\">set binData [<b>zlib decompress<\/b> $compData] <br \/> set string [encoding convertfrom utf-8 $binData]<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">The compression operation from above can also be done with streams, which is especially helpful when you want to accumulate the data by stages:<\/p>\n<p style=\"margin-left:22%; margin-top: 1em\">set strm [<b>zlib stream<\/b> compress] <br \/> $<i>strm<\/i> <b>put<\/b> [encoding convertto utf-8 $string] <br \/> # &#8230; <br \/> $<i>strm<\/i> <b>finalize<\/b> <br \/> set compData [$<i>strm<\/i> <b>get<\/b>] <br \/> $<i>strm<\/i> <b>close<\/b><\/p>\n<h2>SEE ALSO <a name=\"SEE ALSO\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">binary(n), chan(n), encoding(n), Tcl_ZlibDeflate(3), RFC1950 \u2212 RFC1952<\/p>\n<h2>KEYWORDS <a name=\"KEYWORDS\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">compress, decompress, deflate, gzip, inflate, zlib<\/p>\n<hr>\n","protected":false},"excerpt":{"rendered":"<p>  zlib \u2212 compression and decompression operations <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3783,1],"tags":[2635,2921],"class_list":["post-6323","post","type-post","status-publish","format-standard","hentry","category-n-comandos-tcl-tk","category-sin-categoria","tag-mann","tag-zlib"],"gutentor_comment":0,"_links":{"self":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/posts\/6323","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/comments?post=6323"}],"version-history":[{"count":0,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/posts\/6323\/revisions"}],"wp:attachment":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/media?parent=6323"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/categories?post=6323"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/tags?post=6323"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}