CompressionType uses ConstantsTrait
CompressionType
Enumeration class that defines various compression types supported by the application. This class provides constants for different compression algorithms that can be used for file compression and decompression operations.
Tags
Table of Contents
Constants
- BZIP2 = 'bzip2'
- Bzip2 compression
- GZIP = 'gzip'
- GNU zip compression
- LZ4 = 'lz4'
- LZ4 compression
- LZMA = 'lzma'
- LZMA compression
- NONE = 'none'
- No compression applied
- XZ = 'xz'
- XZ compression
- ZIP = 'zip'
- ZIP compression
- ZSTD = 'zstd'
- ZStandard compression
Methods
- getDefault() : string
- Get the default compression type
- getFastCompressionTypes() : array<string|int, string>
- Get compression types that support fast compression
- getHighRatioCompressionTypes() : array<string|int, string>
- Get compression types that provide high compression ratios
Constants
BZIP2
Bzip2 compression
public
string
BZIP2
= 'bzip2'
Block-sorting compression algorithm that typically achieves better compression ratios than GZIP but with slower compression/decompression speed. Good for archival purposes.
GZIP
GNU zip compression
public
string
GZIP
= 'gzip'
GZIP compression algorithm based on DEFLATE. Provides good compression ratios with reasonable speed. Commonly used for web content and single file compression.
LZ4
LZ4 compression
public
string
LZ4
= 'lz4'
Fast compression algorithm that prioritizes speed over compression ratio. Excellent for real-time applications where quick compression/decompression is more important than file size reduction.
LZMA
LZMA compression
public
string
LZMA
= 'lzma'
Lempel-Ziv-Markov chain algorithm that provides excellent compression ratios at the cost of higher CPU usage and memory consumption. Used in 7-Zip and XZ formats.
NONE
No compression applied
public
string
NONE
= 'none'
Represents the absence of compression. Files using this type are stored in their original, uncompressed format.
XZ
XZ compression
public
string
XZ
= 'xz'
Container format that typically uses LZMA2 compression algorithm. Provides very good compression ratios and is commonly used in Unix-like systems for software distribution.
ZIP
ZIP compression
public
string
ZIP
= 'zip'
Popular archive format that supports multiple files and directories. Uses DEFLATE compression algorithm and is widely supported across different platforms and applications.
ZSTD
ZStandard compression
public
string
ZSTD
= 'zstd'
Modern compression algorithm developed by Facebook that offers a good balance between compression ratio and speed. Suitable for real-time compression scenarios.
Methods
getDefault()
Get the default compression type
public
static getDefault() : string
Returns the recommended default compression type for general use. GZIP is chosen as it provides a good balance between compression ratio and performance.
Return values
string —The default compression type
getFastCompressionTypes()
Get compression types that support fast compression
public
static getFastCompressionTypes() : array<string|int, string>
Returns an array of compression types that are optimized for speed rather than compression ratio. Useful for real-time applications.
Return values
array<string|int, string> —Array of fast compression types
getHighRatioCompressionTypes()
Get compression types that provide high compression ratios
public
static getHighRatioCompressionTypes() : array<string|int, string>
Returns an array of compression types that prioritize compression ratio over speed. Suitable for archival and storage optimization.
Return values
array<string|int, string> —Array of high-ratio compression types