nl_tokens: Deflater
pl_tokens: function Deflater ( options ) { var that = this ; var z = new ZStream ( ) ; var bufsize = 512 ; var flush = Z_NO_FLUSH ; var buf = new Uint8Array ( bufsize ) ; var level = options ? options . level : Z_DEFAULT_COMPRESSION ; if ( typeof level === "undefined" ) level = Z_DEFAULT_COMPRESSION ; z . deflateInit ( level ) ; z . next_out = buf ; that . append = function ( data , onprogress ) { var err , buffers = [ ] , lastIndex = 0 , bufferIndex = 0 , bufferSize = 0 , array ; if ( ! data . length ) return ; z . next_in_index = 0 ; z . next_in = data ; z . avail_in = data . length ; do { z . next_out_index = 0 ; z . avail_out = bufsize ; <mask> = z . deflate ( flush ) ; if ( err !== Z_OK ) throw new Error ( "deflating: " + z . msg ) ; if ( z . next_out_index ) if ( z . next_out_index === bufsize ) buffers . push ( new Uint8Array ( buf ) ) ; else buffers . push ( new Uint8Array ( buf . subarray ( 0 , z . next_out_index ) ) ) ; bufferSize += z . next_out_index ; if ( onprogress && z . next_in_index > 0 && z . next_in_index !== lastIndex ) { onprogress ( z . next_in_index ) ; lastIndex = z . next_in_index ; } } while ( z . avail_in > 0 || z . avail_out === 0 ) ; array = new Uint8Array ( bufferSize ) ; buffers . forEach ( function ( chunk ) { array . set ( chunk , bufferIndex ) ; bufferIndex += chunk . length ; } ) ; return array ; } ; that . flush = function ( ) { var err , buffers = [ ] , bufferIndex = 0 , bufferSize = 0 , array ; do { z . next_out_index = 0 ; z . avail_out = bufsize ; err = z . deflate ( Z_FINISH ) ; if ( err !== Z_STREAM_END && err !== Z_OK ) throw new Error ( "deflating: " + z . msg ) ; if ( bufsize - z . avail_out > 0 ) buffers . push ( new Uint8Array ( buf . subarray ( 0 , z . next_out_index ) ) ) ; bufferSize += z . next_out_index ; } while ( z . avail_in > 0 || z . avail_out === 0 ) ; z . deflateEnd ( ) ; array = new Uint8Array ( bufferSize ) ; buffers . forEach ( function ( chunk ) { array . set ( chunk , bufferIndex ) ; bufferIndex += chunk . length ; } ) ; return array ; } ; }