|
jsz
jsz module
doc If something seems wrong or incomplete, please enter a comment at the bottom of this page. jsz moduleThis module manage zlib data compression and decompression. more. jsz::Z classconstructor
Constructs a new inflater or deflater object. example:var compress = new Z( Z.DEFLATE, 9 ); call operatorstring call operator( [ inputData [, forceFinish = false ] ] )This function process inputData as a stream. If forceFinish is true, the inputData and any buffered data are flushed to the outputData. If this function is call without any argument, All remaining data are flushed. Once finished, the object can be reused to process a new stream of data. Propertiesidleboolean idle adler32
Contains the adler32 checksum of the data. more. lengthIn
Contains the current total amount of input data. lengthOut
Contains the current total amount of output data. Static PropertiesConstants
Compression method.
Decompression method. examplevar deflate = new Z( Z.DEFLATE, 9 );
var clearData;
var compressedData;
for ( var i = 10; i >= 0; --i ) {
var chunk = randomString(10000);
compressedData += deflate( chunk );
clearData += chunk;
}
compressedData += deflate(); // flush
var inflate = new Z( Z.INFLATE );
var clearData2 = inflate( compressedData, true );
Print( 'ratio:' + compressedData.length + ': ' + Math.round( 100 * compressedData.length / clearData.length ) + '%','\n');
if ( clearData2 != clearData )
Print('error!!!','\n');
}jsz::ZError classYou cannot construct this class. |
► Sign in to add a comment