[{"data":1,"prerenderedAt":476},["ShallowReactive",2],{"navigation_docs":3,"-guide-limits":84,"-guide-limits-surround":471},[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":86,"body":87,"description":463,"extension":464,"links":465,"meta":466,"navigation":468,"path":29,"seo":469,"stem":30,"__hash__":470},"docs\u002F1.guide\u002F06.limits.md","Limits and partial reads",{"type":88,"value":89,"toc":457},"minimark",[90,95,104,145,148,162,166,224,235,239,242,274,281,349,352,356,443,453],[91,92,94],"h2",{"id":93},"a-limit-on-the-way-out","A limit on the way out",[96,97,98,99,103],"p",{},"A megabyte of zeros gzips to about a thousand bytes. That ratio is the whole point of compression, and also the whole point of a zip bomb. So ",[100,101,102],"code",{},"decompress"," stops at 256 MiB by default, and you can set it lower:",[105,106,111],"pre",{"className":107,"code":108,"language":109,"meta":110,"style":110},"language-ts shiki shiki-themes compressions compressions compressions","decompress(\"deflate\", bomb, { container: \"gzip\", limit: 100_000 });\n\u002F\u002F LimitError: deflate: output passes the limit of 100000 bytes\n","ts","",[100,112,113,138],{"__ignoreMap":110},[114,115,118,121,125,129,132,135],"span",{"class":116,"line":117},"line",1,[114,119,102],{"class":120},"sK71F",[114,122,124],{"class":123},"s38Sx","(",[114,126,128],{"class":127},"shU9J","\"deflate\"",[114,130,131],{"class":123},", bomb, { container: ",[114,133,134],{"class":127},"\"gzip\"",[114,136,137],{"class":123},", limit: 100_000 });\n",[114,139,141],{"class":116,"line":140},2,[114,142,144],{"class":143},"scIB-","\u002F\u002F LimitError: deflate: output passes the limit of 100000 bytes\n",[96,146,147],{},"The check happens before a byte lands, not after the buffer has grown. A size the stream claims up front only sizes the first buffer, and never past the limit or 64 MiB. A liar gets a small buffer and the same error.",[96,149,150,153,154,157,158,161],{},[100,151,152],{},"identify"," and ",[100,155,156],{},"peel"," take the same ",[100,159,160],{},"limit",", applied to every attempt.",[91,163,165],{"id":164},"the-tools-are-stricter","The tools are stricter",[167,168,169,182],"table",{},[170,171,172],"thead",{},[173,174,175,179],"tr",{},[176,177,178],"th",{},"Bound",[176,180,181],{},"Value",[183,184,185,194,205,213],"tbody",{},[173,186,187,191],{},[188,189,190],"td",{},"Output of one stream",[188,192,193],{},"64 MiB",[173,195,196,199],{},[188,197,198],{},"Decompressed bytes shown in one answer",[188,200,201,202],{},"16 KiB by default, up to 1 MiB with ",[100,203,204],{},"length",[173,206,207,210],{},[188,208,209],{},"Input to one call",[188,211,212],{},"4,000,000 characters of base64, hex or text",[173,214,215,221],{},[188,216,217,218,220],{},"Layers ",[100,219,156],{}," takes off",[188,222,223],{},"10",[96,225,226,227,230,231,234],{},"Long output comes in windows. The header says ",[100,228,229],{},"showing 0 to 16384; pass offset for the rest",", and the model asks for the next window with ",[100,232,233],{},"offset",".",[91,236,238],{"id":237},"partial-reads","Partial reads",[96,240,241],{},"A stream cut in half still holds half the data. Ask for it:",[105,243,245],{"className":107,"code":244,"language":109,"meta":110,"style":110},"decompress(\"deflate\", cut, { container: \"gzip\", partial: true });\n\u002F\u002F { bytes: …everything before the cut…,\n\u002F\u002F   details: { error: \"deflate: gzip member ends before its CRC-32 and size\" } }\n",[100,246,247,263,268],{"__ignoreMap":110},[114,248,249,251,253,255,258,260],{"class":116,"line":117},[114,250,102],{"class":120},[114,252,124],{"class":123},[114,254,128],{"class":127},[114,256,257],{"class":123},", cut, { container: ",[114,259,134],{"class":127},[114,261,262],{"class":123},", partial: true });\n",[114,264,265],{"class":116,"line":140},[114,266,267],{"class":143},"\u002F\u002F { bytes: …everything before the cut…,\n",[114,269,271],{"class":116,"line":270},3,[114,272,273],{"class":143},"\u002F\u002F   details: { error: \"deflate: gzip member ends before its CRC-32 and size\" } }\n",[96,275,276,277,280],{},"Without ",[100,278,279],{},"partial",", the same bytes ride on the error:",[105,282,284],{"className":107,"code":283,"language":109,"meta":110,"style":110},"try {\n  decompress(\"deflate\", cut, { container: \"gzip\" });\n} catch (error) {\n  if (error instanceof DecompressError) error.partial;  \u002F\u002F the same bytes\n}\n",[100,285,286,295,311,322,343],{"__ignoreMap":110},[114,287,288,292],{"class":116,"line":117},[114,289,291],{"class":290},"skH_V","try",[114,293,294],{"class":123}," {\n",[114,296,297,300,302,304,306,308],{"class":116,"line":140},[114,298,299],{"class":120},"  decompress",[114,301,124],{"class":123},[114,303,128],{"class":127},[114,305,257],{"class":123},[114,307,134],{"class":127},[114,309,310],{"class":123}," });\n",[114,312,313,316,319],{"class":116,"line":270},[114,314,315],{"class":123},"} ",[114,317,318],{"class":290},"catch",[114,320,321],{"class":123}," (error) {\n",[114,323,325,328,331,334,337,340],{"class":116,"line":324},4,[114,326,327],{"class":290},"  if",[114,329,330],{"class":123}," (error ",[114,332,333],{"class":290},"instanceof",[114,335,336],{"class":120}," DecompressError",[114,338,339],{"class":123},") error.partial;  ",[114,341,342],{"class":143},"\u002F\u002F the same bytes\n",[114,344,346],{"class":116,"line":345},5,[114,347,348],{"class":123},"}\n",[96,350,351],{},"Every format writes as it goes, so what comes out before the damage is real output, not a guess. A wrong checksum works the same way: the bytes are all there, the check just failed. LZMA2 decodes a cut chunk as far as it gets. Inflate never writes a block end it didn't actually read.",[91,353,355],{"id":354},"errors","Errors",[167,357,358,368],{},[170,359,360],{},[173,361,362,365],{},[176,363,364],{},"Error",[176,366,367],{},"When",[183,369,370,388,401,413,423,433],{},[173,371,372,377],{},[188,373,374],{},[100,375,376],{},"DecompressError",[188,378,379,380,383,384,153,386],{},"The stream is broken. Carries ",[100,381,382],{},"format",", ",[100,385,233],{},[100,387,279],{},[173,389,390,395],{},[188,391,392],{},[100,393,394],{},"ChecksumError",[188,396,397,398,400],{},"A checksum or a stored size doesn't match. A ",[100,399,376],{}," too",[173,402,403,408],{},[188,404,405],{},[100,406,407],{},"LimitError",[188,409,410,411],{},"The output passes ",[100,412,160],{},[173,414,415,420],{},[188,416,417],{},[100,418,419],{},"UnsupportedError",[188,421,422],{},"The stream uses something the format allows and this package doesn't do, such as a zstd dictionary",[173,424,425,430],{},[188,426,427],{},[100,428,429],{},"UnknownFormatError",[188,431,432],{},"No format by that name. gzip, xz and friends get pointed to their family",[173,434,435,440],{},[188,436,437],{},[100,438,439],{},"InvalidOptionError",[188,441,442],{},"An option out of range or for another container",[96,444,445,446,449,450,452],{},"All of them extend ",[100,447,448],{},"CompressionError",", so one ",[100,451,318],{}," takes them all.",[454,455,456],"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);}html pre.shiki code .skH_V, html code.shiki .skH_V{--shiki-light:var(--shiki-token-keyword);--shiki-default:var(--shiki-token-keyword);--shiki-dark:var(--shiki-token-keyword)}",{"title":110,"searchDepth":140,"depth":140,"links":458},[459,460,461,462],{"id":93,"depth":140,"text":94},{"id":164,"depth":140,"text":165},{"id":237,"depth":140,"text":238},{"id":354,"depth":140,"text":355},"An output limit so a bomb stays small and partial reads for streams that break halfway","md",null,{"icon":467},"i-lucide-gauge",{"title":28},{"title":86,"description":463},"sl4wmy7n_0ps4wEyex_CGlJMpF9Y-Y-1N8syxs-vzKE",[472,474],{"title":24,"path":25,"stem":26,"description":473,"children":-1},"Which format made these bytes. Ranked by magic numbers and headers and checksums and every layer peeled off in one call",{"title":32,"path":33,"stem":34,"description":475,"children":-1},"compress and decompress and identify and list from the terminal. Files or stdin in raw bytes or hex or base64",1791071143859]