[{"data":1,"prerenderedAt":201},["ShallowReactive",2],{"navigation_docs":3,"-formats-bzip2":84,"-formats-bzip2-surround":196},[4,48],{"title":5,"path":6,"stem":7,"children":8,"icon":47},"Guide","\u002Fguide","1.guide\u002F01.index",[9,11,15,19,23,27,31,35,39,43],{"title":10,"path":6,"stem":7},"Getting Started",{"title":12,"path":13,"stem":14},"Compressing","\u002Fguide\u002Fcompressing","1.guide\u002F02.compressing",{"title":16,"path":17,"stem":18},"Containers","\u002Fguide\u002Fcontainers","1.guide\u002F03.containers",{"title":20,"path":21,"stem":22},"Checksums","\u002Fguide\u002Fchecksums","1.guide\u002F04.checksums",{"title":24,"path":25,"stem":26},"Identify and peel","\u002Fguide\u002Fidentify","1.guide\u002F05.identify",{"title":28,"path":29,"stem":30},"Limits","\u002Fguide\u002Flimits","1.guide\u002F06.limits",{"title":32,"path":33,"stem":34},"CLI","\u002Fguide\u002Fcli","1.guide\u002F07.cli",{"title":36,"path":37,"stem":38},"Agents","\u002Fguide\u002Fagents","1.guide\u002F08.agents",{"title":40,"path":41,"stem":42},"Custom formats","\u002Fguide\u002Fcustom","1.guide\u002F09.custom",{"title":44,"path":45,"stem":46},"Playground","\u002Fguide\u002Fplayground","1.guide\u002F10.playground","i-lucide-book-open",{"title":49,"path":50,"stem":51,"children":52,"icon":83},"Formats","\u002Fformats","2.formats\u002F00.index",[53,55,59,63,67,71,75,79],{"title":54,"path":50,"stem":51},"Every format",{"title":56,"path":57,"stem":58},"deflate","\u002Fformats\u002Fdeflate","2.formats\u002F01.deflate",{"title":60,"path":61,"stem":62},"bzip2","\u002Fformats\u002Fbzip2","2.formats\u002F02.bzip2",{"title":64,"path":65,"stem":66},"LZMA","\u002Fformats\u002Flzma","2.formats\u002F03.lzma",{"title":68,"path":69,"stem":70},"Zstandard","\u002Fformats\u002Fzstd","2.formats\u002F04.zstd",{"title":72,"path":73,"stem":74},"Brotli","\u002Fformats\u002Fbrotli","2.formats\u002F05.brotli",{"title":76,"path":77,"stem":78},"LZ4","\u002Fformats\u002Flz4","2.formats\u002F06.lz4",{"title":80,"path":81,"stem":82},"Unix compress","\u002Fformats\u002Flzw","2.formats\u002F07.lzw","i-lucide-library",{"id":85,"title":60,"body":86,"description":189,"extension":190,"links":191,"meta":192,"navigation":193,"path":61,"seo":194,"stem":62,"__hash__":195},"docs\u002F2.formats\u002F02.bzip2.md",{"type":87,"value":88,"toc":184},"minimark",[89,92,96,136,141,159,162,173,180],[90,91],"format-facts",{"name":60},[93,94,95],"p",{},"bzip2 doesn't look for repeats the way the LZ77 family does. It sorts. Every rotation of a block gets sorted, and the last column of that sort puts similar contexts next to each other. Then move-to-front turns those runs into small numbers, and Huffman codes eat the small numbers. On text it's a beautiful trick. On short input it's mostly overhead:",[97,98,103],"pre",{"className":99,"code":100,"language":101,"meta":102,"style":102},"language-ts shiki shiki-themes compressions compressions compressions","compress(\"bzip2\", \"hello world!\").length;  \u002F\u002F 49 bytes, for 12\n","ts","",[104,105,106],"code",{"__ignoreMap":102},[107,108,111,115,119,123,126,129,132],"span",{"class":109,"line":110},"line",1,[107,112,114],{"class":113},"sK71F","compress",[107,116,118],{"class":117},"s38Sx","(",[107,120,122],{"class":121},"shU9J","\"bzip2\"",[107,124,125],{"class":117},", ",[107,127,128],{"class":121},"\"hello world!\"",[107,130,131],{"class":117},").length;  ",[107,133,135],{"class":134},"scIB-","\u002F\u002F 49 bytes, for 12\n",[137,138,140],"h2",{"id":139},"levels","Levels",[93,142,143,146,147,150,151,154,155,158],{},[104,144,145],{},"level"," is the block size, from 100 kB at 1 to 900 kB at 9, the default. Bigger blocks sort more context together and compress better, and the reader needs more memory. Below the block size the level changes nothing but the ",[104,148,149],{},"h1","…",[104,152,153],{},"h9"," in the header, which comes back as ",[104,156,157],{},"details.level",".",[137,160,20],{"id":161},"checksums",[93,163,164,165,168,169,172],{},"Every block carries the CRC-32\u002FBZIP2 of its output, the MSB-first one, and the stream ends with a CRC combined from all of them. Both get checked. Streams written one after another, the way ",[104,166,167],{},"pbzip2"," writes them, decompress into one output, and ",[104,170,171],{},"details.streams"," counts them when there's more than one.",[93,174,175,176,179],{},"Randomized blocks, which bzip2 stopped writing before 0.9.5, are an ",[104,177,178],{},"UnsupportedError",". Nobody has made one in this century.",[181,182,183],"style",{},"html pre.shiki code .sK71F, html code.shiki .sK71F{--shiki-light:var(--shiki-token-function);--shiki-default:var(--shiki-token-function);--shiki-dark:var(--shiki-token-function)}html pre.shiki code .s38Sx, html code.shiki .s38Sx{--shiki-light:var(--ui-text-highlighted);--shiki-default:var(--ui-text-highlighted);--shiki-dark:var(--ui-text-highlighted)}html pre.shiki code .shU9J, html code.shiki .shU9J{--shiki-light:var(--shiki-token-string);--shiki-default:var(--shiki-token-string);--shiki-dark:var(--shiki-token-string)}html pre.shiki code .scIB-, html code.shiki .scIB-{--shiki-light:var(--shiki-token-comment);--shiki-default:var(--shiki-token-comment);--shiki-dark:var(--shiki-token-comment)}html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}",{"title":102,"searchDepth":185,"depth":185,"links":186},2,[187,188],{"id":139,"depth":185,"text":140},{"id":161,"depth":185,"text":20},"Burrows-Wheeler transform then move-to-front then Huffman. Slow and small on text with a CRC on every block","md",null,{},true,{"title":60,"description":189},"ZLlFEqc5d77wwkOImkVSe8td6wCxB3pD8xH1eKTwG2c",[197,199],{"title":56,"path":57,"stem":58,"description":198,"children":-1},"LZ77 with Huffman codes behind gzip and zlib and PNG and ZIP. Raw or zlib or gzip and one level from 0 to 9",{"title":64,"path":65,"stem":66,"description":200,"children":-1},"LZ77 with a range coder that learns every bit. The xz container with its checks and filters and the older .lzma",1791071141270]