function compress_block(ltree, dtree) {
			var dist; // distance of matched string
			var lc; // match length or unmatched char (if dist === 0)
			var lx = 0; // running index in l_buf
			var code; // the code to send
			var extra; // number of extra bits to send

			if (last_lit !== 0) {
				do {
					dist = ((that.pending_buf[d_buf + lx * 2] << 8) & 0xff00) | (that.pending_buf[d_buf + lx * 2 + 1] & 0xff);
					lc = (that.pending_buf[l_buf + lx]) & 0xff;
					lx++;

					if (dist === 0) {
						send_code(lc, ltree); // send a literal byte
					} else {
						// Here, lc is the match length - MIN_MATCH
						code = Tree._length_code[lc];

						send_code(code + LITERALS + 1, ltree); // send the length
						// code
						extra = Tree.extra_lbits[code];
						if (extra !== 0) {
							lc -= Tree.base_length[code];
							send_bits(lc, extra); // send the extra length bits
						}
						dist--; // dist is now the match distance - 1
						code = Tree.d_code(dist);

						send_code(code, dtree); // send the distance code
						extra = Tree.extra_dbits[code];
						if (extra !== 0) {
							dist -= Tree.base_dist[code];
							send_bits(dist, extra); // send the extra distance bits
						}
					} // literal or match pair ?

					// Check that the overlay between pending_buf and d_buf+l_buf is
					// ok:
				} while (lx < last_lit);
			}

			send_code(END_BLOCK, ltree);
			last_eob_len = ltree[END_BLOCK * 2 + 1];
		}
function compress_block(ltree, dtree) {
			var dist; 
			var lc; 
			var lx = 0; 
			var code; 
			var extra; 

			if (last_lit !== 0) {
				do {
					dist = ((that.pending_buf[d_buf + lx * 2] << 8) & 0xff00) | (that.pending_buf[d_buf + lx * 2 + 1] & 0xff);
					lc = (that.pending_buf[l_buf + lx]) & 0xff;
					lx++;

					if (dist === 0) {
						send_code(lc, ltree); 
					} else {
						
						code = Tree._length_code[lc];

						send_code(code + LITERALS + 1, ltree); 
						
						extra = Tree.extra_lbits[code];
						if (extra !== 0) {
							lc -= Tree.base_length[code];
							send_bits(lc, extra); 
						}
						dist--; 
						code = Tree.d_code(dist);

						send_code(code, dtree); 
						extra = Tree.extra_dbits[code];
						if (extra !== 0) {
							dist -= Tree.base_dist[code];
							send_bits(dist, extra); 
						}
					} 

					
					
				} while (lx < last_lit);
			}

			send_code(END_BLOCK, ltree);
			last_eob_len = ltree[END_BLOCK * 2 + 1];
		}
function compress_block ( ltree , dtree ) { var dist ; // distance of matched string var lc ; // match length or unmatched char (if dist === 0) var lx = 0 ; // running index in l_buf var code ; // the code to send var extra ; // number of extra bits to send if ( last_lit !== 0 ) { do { dist = ( ( that . pending_buf [ d_buf + lx * 2 ] << 8 ) & 0xff00 ) | ( that . pending_buf [ d_buf + lx * 2 + 1 ] & 0xff ) ; lc = ( that . pending_buf [ l_buf + lx ] ) & 0xff ; lx ++ ; if ( dist === 0 ) { send_code ( lc , ltree ) ; // send a literal byte } else { // Here, lc is the match length - MIN_MATCH code = Tree . _length_code [ lc ] ; send_code ( code + LITERALS + 1 , ltree ) ; // send the length // code extra = Tree . extra_lbits [ code ] ; if ( extra !== 0 ) { lc -= Tree . base_length [ code ] ; send_bits ( lc , extra ) ; // send the extra length bits } dist -- ; // dist is now the match distance - 1 code = Tree . d_code ( dist ) ; send_code ( code , dtree ) ; // send the distance code extra = Tree . extra_dbits [ code ] ; if ( extra !== 0 ) { dist -= Tree . base_dist [ code ] ; send_bits ( dist , extra ) ; // send the extra distance bits } } // literal or match pair ? // Check that the overlay between pending_buf and d_buf+l_buf is // ok: } while ( lx < last_lit ) ; } send_code ( END_BLOCK , ltree ) ; last_eob_len = ltree [ END_BLOCK * 2 + 1 ] ; }
Send the block data compressed using the given Huffman trees
Send the block data compressed using the given Huffman trees