LZ4_decompre...ast_continue(9)
π NAME π
LZ4_decompress_fast_continue β decompress blocks in streaming mode, bestie π«
Ok so real talk, this is the kernel API manual (section 9, yes that one) and this little function is basically the group-chat admin for streaming decompression. Let's get into it π«Ά
β¨ SYNOPSIS β¨
int LZ4_decompress_fast_continue (LZ4_streamDecode_t *LZ4_streamDecode ,
const char *source , char *dest , int originalSize );
π ARGUMENTS π
LZ4_streamDecodeβ the'LZ4_streamDecode_t'structure. yeah. that one. your stream-decode state bestie π§sourceβ source address of the compressed data π₯destβ output buffer address of the uncompressed data, which must already be allocated with'originalSize'bytes. no, it will not grow itself for you πoriginalSizeβ the original and therefore uncompressed size πΈ
π¦ DESCRIPTION π¦
This decoding function lets you decompress multiple blocks in "streaming" mode. Iconic. But here's the rule you literally cannot skip: previously decoded blocks *must* stay available at the memory position where they were decoded (up to 64 KB). Not "should". Must. Non-negotiable π
In the case of ring buffers, the decoding buffer must be either:
- Exactly the same size as the encoding buffer, with the same update rule (block boundaries at the same positions). In which case, the decoding & encoding ring buffer can have any size, including very small ones ( < 64 KB). slay β¨
- Larger than the encoding buffer, by a minimum of
maxBlockSizemore bytes.maxBlockSizeis implementation dependent β it's the maximum size you intend to compress into a single block. In which case, encoding and decoding buffers do not need to be synchronized, and the encoding ring buffer can have any size, including small ones ( < 64 KB) π - At least 64 KB + 8 bytes +
maxBlockSize. In which case, encoding and decoding buffers do not need to be synchronized, and the encoding ring buffer can have any size, including larger than the decoding buffer. Whenever these conditions are not possible, save the last 64 KB of decoded data into a safe buffer, and indicate where it is saved usingLZ4_setStreamDecodeπ«Ά
lowkey important: those three options are the only options. vibe check your buffer sizes before you ship, ngl π
π₯ RETURN π₯
Number of bytes decompressed into the destination buffer (necessarily <= maxDecompressedSize), or a negative result in case of error. So if it comes back negative, that's not a slay, that's a cry for help π
π SEE ALSO π
Kernel file ./include/linux/lz4.h
LZ4_compressBound(9)LZ4_compress_default(9)LZ4_compress_fast(9)LZ4_compress_destSize(9)LZ4_decompress_fast(9)LZ4_decompress_safe(9)LZ4_decompress_safe_partial(9)LZ4_compress_HC(9)LZ4_resetStreamHC(9)LZ4_loadDictHC(9)LZ4_compress_HC_continue(9)LZ4_saveDictHC(9)LZ4_resetStream(9)LZ4_loadDict(9)LZ4_saveDict(9)LZ4_compress_fast_continue(9)LZ4_setStreamDecode(9)LZ4_decompress_safe_continue(9)LZ4_decompress_safe_usingDict(9)LZ4_decompress_fast_usingDict(9)
k bye bestie, go decompress responsibly π this one came straight out of ./include/linux in the October 2026 edition of the Kernel API Manual β catch you in LZ4_decompre...ast_continue(9) again soon πβ¨
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms