pb.run(function(updater) { var bit, byte; var cstream = []; for (var i = 0; i < readCount; i++) { bit = bits.readBits(1, false); cstream.push(bit); byte = findInTree(tree, cstream); if (byte !== null) { data.uwrite(byte); cstream = []; } if (i % 1000 === 0) { updater(); } } });