Skip to content

Commit ccdfebe

Browse files
author
Vadim Belov
committed
Add CompressionAlgorithm enum with detailed documentation
Introduces the CompressionAlgorithm enum in the EasyExtensions.Models.Enums namespace. This enum covers a wide range of compression algorithms, each with XML documentation describing their use cases, performance characteristics, and platform considerations to aid in selecting the appropriate algorithm for data encoding or decoding.
1 parent 9c175bd commit ccdfebe

1 file changed

Lines changed: 84 additions & 0 deletions

File tree

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
namespace EasyExtensions.Models.Enums
2+
{
3+
/// <summary>
4+
/// Specifies the available compression algorithms for encoding or decoding data streams.
5+
/// </summary>
6+
/// <remarks>Use this enumeration to select a compression algorithm based on your requirements for speed,
7+
/// compression ratio, compatibility, and platform support. Some algorithms are optimized for fast compression and
8+
/// decompression (such as LZ4 and Snappy), while others provide higher compression ratios at the cost of speed
9+
/// (such as XZ and LZMA). Not all algorithms may be supported on all platforms or by all libraries. Choose the
10+
/// algorithm that best matches your use case, such as archival storage, web asset delivery, or real-time
11+
/// processing.</remarks>
12+
public enum CompressionAlgorithm
13+
{
14+
/// <summary>
15+
/// No compression. Best for already-compressed data (JPEG/PNG/MP4/ZIP) to avoid wasted CPU.
16+
/// </summary>
17+
None = 0,
18+
19+
/// <summary>
20+
/// Raw DEFLATE stream (no container). Rare as a storage format; common inside ZIP/PNG and some protocols.
21+
/// </summary>
22+
Deflate = 1,
23+
24+
/// <summary>
25+
/// zlib wrapper around DEFLATE (RFC 1950). Common in libraries/protocols.
26+
/// </summary>
27+
Zlib = 2,
28+
29+
/// <summary>
30+
/// gzip container around DEFLATE (RFC 1952). Very compatible and widely supported; usually worse than Zstd for storage.
31+
/// </summary>
32+
Gzip = 3,
33+
34+
/// <summary>
35+
/// Brotli. Great for web assets (HTML/CSS/JS); often slower to compress for mixed-content storage.
36+
/// </summary>
37+
Brotli = 4,
38+
39+
/// <summary>
40+
/// Zstandard (Zstd). Excellent general-purpose default for storage: fast decompression + strong ratio.
41+
/// </summary>
42+
Zstd = 5,
43+
44+
/// <summary>
45+
/// LZ4. Extremely fast compression/decompression with low latency; weaker ratio than Zstd.
46+
/// </summary>
47+
Lz4 = 6,
48+
49+
/// <summary>
50+
/// Snappy. Very fast, common in some storage/log pipelines; typically weaker ratio than Zstd.
51+
/// </summary>
52+
Snappy = 7,
53+
54+
/// <summary>
55+
/// LZO. Older fast codec seen in some systems; usually less popular than LZ4/Zstd today.
56+
/// </summary>
57+
Lzo = 8,
58+
59+
/// <summary>
60+
/// bzip2. Better ratio than gzip in some cases, but slow; mostly legacy/archival.
61+
/// </summary>
62+
Bzip2 = 9,
63+
64+
/// <summary>
65+
/// XZ (LZMA2 in .xz container). Very high ratio, but slow and high-latency; archival, not “on-the-fly”.
66+
/// </summary>
67+
Xz = 10,
68+
69+
/// <summary>
70+
/// LZMA (classic). High ratio, very slow; mostly archival/legacy.
71+
/// </summary>
72+
Lzma = 11,
73+
74+
/// <summary>
75+
/// LZFSE. Apple codec (iOS/macOS). Fast-ish with decent ratio; mostly relevant on Apple ecosystems.
76+
/// </summary>
77+
Lzfse = 12,
78+
79+
/// <summary>
80+
/// Zopfli (deflate-optimizer). Extremely slow compression for slightly smaller gzip/deflate; offline packaging only.
81+
/// </summary>
82+
Zopfli = 13
83+
}
84+
}

0 commit comments

Comments
 (0)