[{"data":1,"prerenderedAt":552},["ShallowReactive",2],{"navigation_docs":3,"-guide-containers":84,"-guide-containers-surround":547},[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":16,"body":86,"description":539,"extension":540,"links":541,"meta":542,"navigation":544,"path":17,"seo":545,"stem":18,"__hash__":546},"docs\u002F1.guide\u002F03.containers.md",{"type":87,"value":88,"toc":527},"minimark",[89,94,98,101,175,185,189,426,430,433,455,457,482,484,487,490,499,503,512,516,523],[90,91,93],"h2",{"id":92},"one-compression-several-wrappers","One compression, several wrappers",[95,96,97],"p",{},"A container is the packaging around a compressed stream: a magic number so tools recognize it, a header with metadata, a checksum at the end. The compression inside doesn't change. gzip and zlib carry the exact same deflate data, they just wrap it differently.",[95,99,100],{},"So here a container is an option of its format, never a format of its own:",[102,103,108],"pre",{"className":104,"code":105,"language":106,"meta":107,"style":107},"language-ts shiki shiki-themes compressions compressions compressions","compress(\"deflate\", data);                          \u002F\u002F raw deflate, RFC 1951\ncompress(\"deflate\", data, { container: \"zlib\" });   \u002F\u002F RFC 1950\ncompress(\"deflate\", data, { container: \"gzip\" });   \u002F\u002F RFC 1952\n","ts","",[109,110,111,135,156],"code",{"__ignoreMap":107},[112,113,116,120,124,128,131],"span",{"class":114,"line":115},"line",1,[112,117,119],{"class":118},"sK71F","compress",[112,121,123],{"class":122},"s38Sx","(",[112,125,127],{"class":126},"shU9J","\"deflate\"",[112,129,130],{"class":122},", data);                          ",[112,132,134],{"class":133},"scIB-","\u002F\u002F raw deflate, RFC 1951\n",[112,136,138,140,142,144,147,150,153],{"class":114,"line":137},2,[112,139,119],{"class":118},[112,141,123],{"class":122},[112,143,127],{"class":126},[112,145,146],{"class":122},", data, { container: ",[112,148,149],{"class":126},"\"zlib\"",[112,151,152],{"class":122}," });   ",[112,154,155],{"class":133},"\u002F\u002F RFC 1950\n",[112,157,159,161,163,165,167,170,172],{"class":114,"line":158},3,[112,160,119],{"class":118},[112,162,123],{"class":122},[112,164,127],{"class":126},[112,166,146],{"class":122},[112,168,169],{"class":126},"\"gzip\"",[112,171,152],{"class":122},[112,173,174],{"class":133},"\u002F\u002F RFC 1952\n",[95,176,177,178,181,182,184],{},"The first container is the default. Asking for ",[109,179,180],{},"gzip"," as a format gets you an error that names ",[109,183,56],{}," and the container, so nobody has to guess.",[90,186,188],{"id":187},"every-container","Every container",[190,191,192,214],"table",{},[193,194,195],"thead",{},[196,197,198,202,205,208,211],"tr",{},[199,200,201],"th",{},"Format",[199,203,204],{},"Container",[199,206,207],{},"Magic",[199,209,210],{},"Header",[199,212,213],{},"Check",[215,216,217,234,252,271,291,312,332,352,368,389,407],"tbody",{},[196,218,219,222,227,230,232],{},[220,221,56],"td",{},[220,223,224],{},[109,225,226],{},"raw",[220,228,229],{},"none",[220,231,229],{},[220,233,229],{},[196,235,236,238,243,246,249],{},[220,237,56],{},[220,239,240],{},[109,241,242],{},"zlib",[220,244,245],{},"none, two header bytes with a check",[220,247,248],{},"method, window, level hint",[220,250,251],{},"Adler-32",[196,253,254,256,260,265,268],{},[220,255,56],{},[220,257,258],{},[109,259,180],{},[220,261,262],{},[109,263,264],{},"1f 8b 08",[220,266,267],{},"flags, mtime, OS, optional name and comment",[220,269,270],{},"CRC-32 and size",[196,272,273,275,279,285,288],{},[220,274,60],{},[220,276,277],{},[109,278,60],{},[220,280,281,284],{},[109,282,283],{},"BZh"," and the block size digit",[220,286,287],{},"per block magic and CRC",[220,289,290],{},"CRC-32\u002FBZIP2 per block and per stream",[196,292,293,296,301,307,310],{},[220,294,295],{},"lzma",[220,297,298],{},[109,299,300],{},"alone",[220,302,303,304],{},"none, the properties byte is usually ",[109,305,306],{},"5d",[220,308,309],{},"properties, dictionary size, size",[220,311,229],{},[196,313,314,316,321,326,329],{},[220,315,295],{},[220,317,318],{},[109,319,320],{},"xz",[220,322,323],{},[109,324,325],{},"fd 37 7a 58 5a 00",[220,327,328],{},"stream flags, block headers with filters",[220,330,331],{},"CRC-32, CRC-64 or SHA-256 per block, CRC-32 everywhere else",[196,333,334,337,341,346,349],{},[220,335,336],{},"zstd",[220,338,339],{},[109,340,336],{},[220,342,343],{},[109,344,345],{},"28 b5 2f fd",[220,347,348],{},"window, dictionary id, content size",[220,350,351],{},"XXH64, low 32 bits",[196,353,354,357,361,363,366],{},[220,355,356],{},"brotli",[220,358,359],{},[109,360,356],{},[220,362,229],{},[220,364,365],{},"window bits",[220,367,229],{},[196,369,370,373,378,383,386],{},[220,371,372],{},"lz4",[220,374,375],{},[109,376,377],{},"frame",[220,379,380],{},[109,381,382],{},"04 22 4d 18",[220,384,385],{},"flags, block size, content size",[220,387,388],{},"XXH32 of the header, blocks and content",[196,390,391,393,398,403,405],{},[220,392,372],{},[220,394,395],{},[109,396,397],{},"legacy",[220,399,400],{},[109,401,402],{},"02 21 4c 18",[220,404,229],{},[220,406,229],{},[196,408,409,412,416,421,424],{},[220,410,411],{},"lzw",[220,413,414],{},[109,415,119],{},[220,417,418],{},[109,419,420],{},"1f 9d",[220,422,423],{},"maximum code width, block mode",[220,425,229],{},[90,427,429],{"id":428},"what-each-one-adds","What each one adds",[431,432,180],"h3",{"id":180},[95,434,435,436,438,439,442,443,446,447,450,451,454],{},"It stores an optional file name and comment, a modification time and the OS. ",[109,437,119],{}," writes ",[109,440,441],{},"name"," and ",[109,444,445],{},"mtime"," when you pass them and OS 255, unknown, so the bytes don't depend on the machine. ",[109,448,449],{},"decompress"," reads every member, as ",[109,452,453],{},"gunzip"," does.",[431,456,242],{"id":242},[95,458,459,460,462,463,466,467,466,470,473,474,477,478,481],{},"Two header bytes and an Adler-32. The second byte carries a level hint, which ",[109,461,449],{}," reports as ",[109,464,465],{},"fastest",", ",[109,468,469],{},"fast",[109,471,472],{},"default"," or ",[109,475,476],{},"best",". A stream that needs a preset dictionary is refused with ",[109,479,480],{},"UnsupportedError",".",[431,483,320],{"id":320},[95,485,486],{},"The elaborate one. Blocks, each with its own filter chain and check, an index of the blocks and a footer that points back at it. This package reads LZMA2 with the delta and x86 filters before it, and every check type it knows how to compute. It writes one block with LZMA2 and the check you pick, CRC-64 by default.",[431,488,489],{"id":295},".lzma",[95,491,492,494,495,498],{},[109,493,300],{}," here. It's what LZMA Utils wrote before xz: thirteen header bytes and the raw range coded stream. No checksum, so a damaged file decodes into garbage instead of an error. ",[109,496,497],{},"xz --format=lzma"," still writes it.",[431,500,502],{"id":501},"lz4-frame","LZ4 frame",[95,504,505,506,508,509,511],{},"It checks itself three ways: a byte of XXH32 closes the header, and the frame can carry XXH32 after every block and after the content. ",[109,507,119],{}," writes the content checksum, like the ",[109,510,372],{}," command.",[431,513,515],{"id":514},"lz4-legacy","LZ4 legacy",[95,517,518,519,522],{},"It's the old ",[109,520,521],{},"lz4 -l"," format. Blocks of up to 8 MiB, no checksum, no end mark. Linux still boots kernels packed in it.",[524,525,526],"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":107,"searchDepth":137,"depth":137,"links":528},[529,530,531],{"id":92,"depth":137,"text":93},{"id":187,"depth":137,"text":188},{"id":428,"depth":137,"text":429,"children":532},[533,534,535,536,537,538],{"id":180,"depth":158,"text":180},{"id":242,"depth":158,"text":242},{"id":320,"depth":158,"text":320},{"id":295,"depth":158,"text":489},{"id":501,"depth":158,"text":502},{"id":514,"depth":158,"text":515},"gzip and zlib and raw deflate are one compression in three wrappers. Why that's an option and what each wrapper adds","md",null,{"icon":543},"i-lucide-package",true,{"title":16,"description":539},"43-pLs521Gp4Lv5aD8GIBrw-O-CA28cjQPatp-1921U",[548,550],{"title":12,"path":13,"stem":14,"description":549,"children":-1},"Two calls for every format. Options and levels and the format objects and one subpath per format",{"title":20,"path":21,"stem":22,"description":551,"children":-1},"CRC-32 and Adler-32 and CRC-64 and XXH32 and XXH64. Every one checked on the way out and a wrong one is an error",1791071143764]