snyk-docker-plugin
Version:
Snyk CLI docker plugin
20 lines (19 loc) • 890 B
TypeScript
/// <reference types="node" />
import { Transform } from "stream";
/**
* Creates a transform stream that automatically detects and decompresses data based on magic numbers.
*
* Supports three formats:
* - gzip (magic: 1f 8b) - Streamed through Node.js built-in zlib
* - zstd (magic: 28 b5 2f fd) - Streamed through fzstd library
* - uncompressed - Passed through unchanged
*
* Both gzip and zstd use streaming decompression to avoid buffering entire layers in memory.
* This is critical for handling large image layers (multiple GB) without excessive memory usage.
*
* OCI images from containerd may use zstd compression, while older Docker archives use gzip.
* Manifest and config files within OCI archives are typically uncompressed JSON.
*
* Named after the gunzip-maybe library, which only handled gzip detection.
*/
export declare function decompressMaybe(): Transform;