omnizip 0.4.9-arm-linux → 0.4.11-arm-linux
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.rubocop-oss.yml +814 -0
- data/.rubocop.yml +15 -1
- data/.rubocop_todo.yml +7 -1
- data/CHANGELOG.md +17 -0
- data/Gemfile +23 -1
- data/README.adoc +101 -1282
- data/docs/compatibility.adoc +1 -2
- data/docs/lychee.toml +1 -7
- data/lib/omnizip/algorithms/deflate/constants.rb +5 -3
- data/lib/omnizip/implementations/rust/archive.rb +9 -41
- data/lib/omnizip/implementations/rust/ffi_library.rb +127 -0
- data/lib/omnizip/implementations/rust/fiddle_library.rb +144 -0
- data/lib/omnizip/implementations/rust/library.rb +39 -104
- data/lib/omnizip/implementations/rust.rb +2 -0
- data/lib/omnizip/version.rb +1 -1
- data/lib/tasks/docs.rake +146 -0
- data/readme-docs/rar-archives.adoc +505 -0
- data/scripts/generate_rar_oracle_fixtures.rb +177 -0
- data/vendor/libomnizip_ffi.so +0 -0
- metadata +21 -74
- data/TODO.refactor/00-overview.md +0 -67
- data/TODO.refactor/01-registry-base-class.md +0 -81
- data/TODO.refactor/02-error-hierarchy.md +0 -57
- data/TODO.refactor/03-autoload-entry-point.md +0 -69
- data/TODO.refactor/04-filter-base-consolidation.md +0 -49
- data/TODO.refactor/05-send-private-methods.md +0 -64
- data/TODO.refactor/06-instance-variable-access.md +0 -69
- data/TODO.refactor/07-respond-to-replacement.md +0 -237
- data/TODO.refactor/08-spec-doubles.md +0 -27
- data/TODO.refactor/09-cli-shared-module.md +0 -35
- data/TODO.refactor/10-format-detector-ocp.md +0 -34
- data/TODO.refactor/11-convenience-decoupling.md +0 -38
- data/TODO.refactor/12-thread-safety.md +0 -8
- data/TODO.refactor/13-lutaml-model-migration.md +0 -158
- data/TODO.refactor/14-add-missing-specs.md +0 -25
- data/docs/.github/workflows/docs.yml +0 -142
- data/docs/.gitignore +0 -21
- data/docs/Gemfile +0 -13
- data/docs/README.md +0 -101
- data/docs/_config.yml +0 -112
- data/docs/comparison/feature-matrix.adoc +0 -694
- data/docs/comparison/index.adoc +0 -113
- data/docs/comparison/vs-7zip.adoc +0 -309
- data/docs/comparison/vs-peazip.adoc +0 -77
- data/docs/comparison/vs-rubyzip.adoc +0 -342
- data/docs/comparison/vs-winrar.adoc +0 -100
- data/docs/concepts/index.adoc +0 -129
- data/docs/developer/architecture.adoc +0 -256
- data/docs/developer/contributing.adoc +0 -158
- data/docs/developer/index.adoc +0 -25
- data/docs/developer/testing.adoc +0 -212
- data/docs/getting-started/basic-usage.adoc +0 -263
- data/docs/getting-started/index.adoc +0 -42
- data/docs/getting-started/installation.adoc +0 -138
- data/docs/getting-started/quick-start.adoc +0 -183
- data/docs/getting-started/your-first-archive.adoc +0 -219
- data/docs/guides/advanced-features/encryption.adoc +0 -277
- data/docs/guides/advanced-features/index.adoc +0 -59
- data/docs/guides/advanced-features/parallel-processing.adoc +0 -144
- data/docs/guides/advanced-features/progress-tracking.adoc +0 -124
- data/docs/guides/advanced-features/streaming.adoc +0 -142
- data/docs/guides/archive-formats/gzip-format.adoc +0 -105
- data/docs/guides/archive-formats/index.adoc +0 -160
- data/docs/guides/archive-formats/ole-format.adoc +0 -151
- data/docs/guides/archive-formats/rar-format.adoc +0 -104
- data/docs/guides/archive-formats/rar5.adoc +0 -521
- data/docs/guides/archive-formats/rpm-format.adoc +0 -108
- data/docs/guides/archive-formats/seven-zip-format.adoc +0 -35
- data/docs/guides/archive-formats/tar-format.adoc +0 -106
- data/docs/guides/archive-formats/xz-format.adoc +0 -118
- data/docs/guides/archive-formats/zip-format.adoc +0 -35
- data/docs/guides/compression-algorithms/bzip2.adoc +0 -114
- data/docs/guides/compression-algorithms/deflate.adoc +0 -313
- data/docs/guides/compression-algorithms/index.adoc +0 -190
- data/docs/guides/compression-algorithms/lzma.adoc +0 -394
- data/docs/guides/compression-algorithms/lzma2.adoc +0 -244
- data/docs/guides/compression-algorithms/ppmd.adoc +0 -313
- data/docs/guides/compression-algorithms/zstandard.adoc +0 -296
- data/docs/guides/creating-archives.adoc +0 -348
- data/docs/guides/extracting-archives.adoc +0 -53
- data/docs/guides/format-conversion.adoc +0 -64
- data/docs/guides/index.adoc +0 -49
- data/docs/guides/migration-rubyzip.adoc +0 -217
- data/docs/guides/parity-archives.adoc +0 -605
- data/docs/guides/performance-tuning.adoc +0 -88
- data/docs/index.adoc +0 -228
- data/docs/reference/api/overview.adoc +0 -187
- data/docs/reference/cli/compress-command.adoc +0 -114
- data/docs/reference/cli/overview.adoc +0 -140
- data/docs/reference/index.adoc +0 -26
- data/docs/resources/faq.adoc +0 -185
- data/docs/resources/quick-reference.adoc +0 -222
- data/docs/troubleshooting/index.adoc +0 -207
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: RPM Format
|
|
3
|
-
nav_order: 9
|
|
4
|
-
parent: Archive Formats
|
|
5
|
-
grand_parent: Guides
|
|
6
|
-
---
|
|
7
|
-
|
|
8
|
-
[[rpm-format]]
|
|
9
|
-
== Purpose
|
|
10
|
-
|
|
11
|
-
RPM is the package format of Red Hat-based Linux distributions. An
|
|
12
|
-
RPM file is a lead, signature, metadata header and a payload — a
|
|
13
|
-
CPIO archive compressed with gzip/bzip2/xz/zstd.
|
|
14
|
-
|
|
15
|
-
== Basic Usage
|
|
16
|
-
|
|
17
|
-
=== Open a Package
|
|
18
|
-
|
|
19
|
-
[source,ruby]
|
|
20
|
-
----
|
|
21
|
-
Omnizip::Formats::Rpm.open('package.rpm') do |rpm|
|
|
22
|
-
puts rpm.files.size
|
|
23
|
-
end
|
|
24
|
-
|
|
25
|
-
rpm = Omnizip::Formats::Rpm.open('package.rpm')
|
|
26
|
-
rpm.close
|
|
27
|
-
----
|
|
28
|
-
|
|
29
|
-
=== Package Metadata
|
|
30
|
-
|
|
31
|
-
[source,ruby]
|
|
32
|
-
----
|
|
33
|
-
info = Omnizip::Formats::Rpm.info('package.rpm')
|
|
34
|
-
puts info[:name] # => "app"
|
|
35
|
-
puts info[:version]
|
|
36
|
-
puts info[:release]
|
|
37
|
-
puts info[:arch]
|
|
38
|
-
puts info[:summary]
|
|
39
|
-
puts info[:license]
|
|
40
|
-
puts info[:vendor]
|
|
41
|
-
puts info[:build_time]
|
|
42
|
-
puts info[:file_count]
|
|
43
|
-
|
|
44
|
-
# Same details on the reader
|
|
45
|
-
Omnizip::Formats::Rpm.open('package.rpm') do |rpm|
|
|
46
|
-
puts rpm.name
|
|
47
|
-
puts rpm.version
|
|
48
|
-
puts rpm.license
|
|
49
|
-
end
|
|
50
|
-
----
|
|
51
|
-
|
|
52
|
-
=== List and Extract Files
|
|
53
|
-
|
|
54
|
-
[source,ruby]
|
|
55
|
-
----
|
|
56
|
-
# File paths inside the payload
|
|
57
|
-
Omnizip::Formats::Rpm.list('package.rpm')
|
|
58
|
-
|
|
59
|
-
# Extract the payload (CPIO contents)
|
|
60
|
-
Omnizip::Formats::Rpm.extract('package.rpm', '/output/directory/')
|
|
61
|
-
|
|
62
|
-
# Or per-reader
|
|
63
|
-
Omnizip::Formats::Rpm.open('package.rpm') do |rpm|
|
|
64
|
-
rpm.extract('/output/directory/')
|
|
65
|
-
end
|
|
66
|
-
----
|
|
67
|
-
|
|
68
|
-
== RPM Structure
|
|
69
|
-
|
|
70
|
-
. **Lead** - 96 bytes identifying the package
|
|
71
|
-
. **Signature** - cryptographic signatures
|
|
72
|
-
. **Header** - metadata (name, version, dependencies)
|
|
73
|
-
. **Payload** - CPIO archive
|
|
74
|
-
|
|
75
|
-
[source,ruby]
|
|
76
|
-
----
|
|
77
|
-
rpm = Omnizip::Formats::Rpm.open('package.rpm')
|
|
78
|
-
puts rpm.lead.inspect
|
|
79
|
-
puts rpm.signature.inspect
|
|
80
|
-
puts rpm.header.inspect
|
|
81
|
-
----
|
|
82
|
-
|
|
83
|
-
== Payload
|
|
84
|
-
|
|
85
|
-
[source,ruby]
|
|
86
|
-
----
|
|
87
|
-
Omnizip::Formats::Rpm.open('package.rpm') do |rpm|
|
|
88
|
-
puts "Compression: #{rpm.payload_compressor}"
|
|
89
|
-
|
|
90
|
-
# Compressed CPIO bytes; decompress with the matching format
|
|
91
|
-
payload = rpm.payload
|
|
92
|
-
end
|
|
93
|
-
----
|
|
94
|
-
|
|
95
|
-
== Dependencies
|
|
96
|
-
|
|
97
|
-
[source,ruby]
|
|
98
|
-
----
|
|
99
|
-
Omnizip::Formats::Rpm.open('package.rpm') do |rpm|
|
|
100
|
-
rpm.requires.each { |name, op, version| puts "#{name} #{op} #{version}" }
|
|
101
|
-
rpm.provides.each { |name, op, version| puts "#{name} #{op} #{version}" }
|
|
102
|
-
rpm.conflicts.each { |name, op, version| puts "#{name} #{op} #{version}" }
|
|
103
|
-
end
|
|
104
|
-
----
|
|
105
|
-
|
|
106
|
-
== See Also
|
|
107
|
-
|
|
108
|
-
* link:gzip-format.html[GZIP Format] - Common payload compression
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: 7z Format
|
|
3
|
-
nav_order: 1
|
|
4
|
-
parent: Archive Formats
|
|
5
|
-
grand_parent: Guides
|
|
6
|
-
---
|
|
7
|
-
|
|
8
|
-
== 7z Format
|
|
9
|
-
|
|
10
|
-
=== General
|
|
11
|
-
|
|
12
|
-
The 7z format is a compressed archive format created by 7-Zip.
|
|
13
|
-
|
|
14
|
-
=== Features
|
|
15
|
-
|
|
16
|
-
* High compression ratio (LZMA2)
|
|
17
|
-
* Solid archives
|
|
18
|
-
* Multi-volume support
|
|
19
|
-
* AES-256 encryption
|
|
20
|
-
|
|
21
|
-
=== Usage
|
|
22
|
-
|
|
23
|
-
[source,bash]
|
|
24
|
-
----
|
|
25
|
-
# Create 7z archive
|
|
26
|
-
omnizip archive create backup.7z documents/
|
|
27
|
-
|
|
28
|
-
# Extract 7z archive
|
|
29
|
-
omnizip archive extract backup.7z output/
|
|
30
|
-
----
|
|
31
|
-
|
|
32
|
-
=== See Also
|
|
33
|
-
|
|
34
|
-
* link:../compression-algorithms/lzma2.html[LZMA2 Algorithm]
|
|
35
|
-
|
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: TAR Format
|
|
3
|
-
nav_order: 4
|
|
4
|
-
parent: Archive Formats
|
|
5
|
-
grand_parent: Guides
|
|
6
|
-
---
|
|
7
|
-
|
|
8
|
-
== Purpose
|
|
9
|
-
|
|
10
|
-
TAR (Tape Archive) is the standard archive format on Unix/Linux systems. It combines multiple files into a single archive without compression, typically paired with external compression tools.
|
|
11
|
-
|
|
12
|
-
== Key Characteristics
|
|
13
|
-
|
|
14
|
-
[cols="1,3"]
|
|
15
|
-
|===
|
|
16
|
-
|Property |Value
|
|
17
|
-
|
|
18
|
-
|Compression
|
|
19
|
-
|External (GZIP, BZip2, XZ)
|
|
20
|
-
|
|
21
|
-
|Encryption
|
|
22
|
-
|None
|
|
23
|
-
|
|
24
|
-
|POSIX Support
|
|
25
|
-
|Full POSIX.1-1988 and POSIX.1-2001
|
|
26
|
-
|
|
27
|
-
|Large Files
|
|
28
|
-
|Yes (with extensions)
|
|
29
|
-
|
|
30
|
-
|Best For
|
|
31
|
-
|Unix backups, software packaging, source distribution
|
|
32
|
-
|===
|
|
33
|
-
|
|
34
|
-
== Common TAR Variants
|
|
35
|
-
|
|
36
|
-
[cols="1,2,2"]
|
|
37
|
-
|===
|
|
38
|
-
|Extension |Compression |Typical Use
|
|
39
|
-
|
|
40
|
-
|`.tar`
|
|
41
|
-
|None
|
|
42
|
-
|Intermediate archives
|
|
43
|
-
|
|
44
|
-
|`.tar.gz` / `.tgz`
|
|
45
|
-
|GZIP (Deflate)
|
|
46
|
-
|Source distributions
|
|
47
|
-
|
|
48
|
-
|`.tar.bz2` / `.tbz2`
|
|
49
|
-
|BZip2
|
|
50
|
-
|Better compression
|
|
51
|
-
|
|
52
|
-
|`.tar.xz` / `.txz`
|
|
53
|
-
|XZ (LZMA2)
|
|
54
|
-
|Maximum compression
|
|
55
|
-
|===
|
|
56
|
-
|
|
57
|
-
== Basic Usage
|
|
58
|
-
|
|
59
|
-
=== Create TAR Archive
|
|
60
|
-
|
|
61
|
-
[source,ruby]
|
|
62
|
-
----
|
|
63
|
-
# Create uncompressed TAR
|
|
64
|
-
Omnizip::Archive.create('backup.tar', format: :tar) do |archive|
|
|
65
|
-
archive.add_directory('project/')
|
|
66
|
-
end
|
|
67
|
-
|
|
68
|
-
# Create TAR.GZ
|
|
69
|
-
Omnizip.compress_directory('project/', 'backup.tar.gz',
|
|
70
|
-
format: :tar_gzip,
|
|
71
|
-
level: 6
|
|
72
|
-
)
|
|
73
|
-
|
|
74
|
-
# Create TAR.XZ
|
|
75
|
-
Omnizip.compress_directory('project/', 'backup.tar.xz',
|
|
76
|
-
format: :tar_xz,
|
|
77
|
-
level: 6
|
|
78
|
-
)
|
|
79
|
-
----
|
|
80
|
-
|
|
81
|
-
=== Extract TAR Archive
|
|
82
|
-
|
|
83
|
-
[source,ruby]
|
|
84
|
-
----
|
|
85
|
-
# Extract TAR.GZ
|
|
86
|
-
Omnizip.extract_archive('backup.tar.gz', 'output/')
|
|
87
|
-
|
|
88
|
-
# Extract TAR.XZ
|
|
89
|
-
Omnizip.extract_archive('backup.tar.xz', 'output/')
|
|
90
|
-
----
|
|
91
|
-
|
|
92
|
-
== POSIX Features
|
|
93
|
-
|
|
94
|
-
Omnizip supports extended POSIX features:
|
|
95
|
-
|
|
96
|
-
* **Long filenames** (beyond 100 characters)
|
|
97
|
-
* **Symbolic links**
|
|
98
|
-
* **File permissions**
|
|
99
|
-
* **Ownership information**
|
|
100
|
-
* **Sparse files**
|
|
101
|
-
|
|
102
|
-
== See Also
|
|
103
|
-
|
|
104
|
-
* link:gzip-format.html[GZIP Format] - Common TAR compression
|
|
105
|
-
* link:xz-format.html[XZ Format] - Maximum compression for TAR
|
|
106
|
-
* link:../../compatibility.html[Compatibility] - TAR support across tools
|
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: XZ Format
|
|
3
|
-
nav_order: 6
|
|
4
|
-
parent: Archive Formats
|
|
5
|
-
grand_parent: Guides
|
|
6
|
-
---
|
|
7
|
-
|
|
8
|
-
== Purpose
|
|
9
|
-
|
|
10
|
-
XZ is a modern compression format based on LZMA2 that provides excellent compression ratios. It's commonly used for Linux package distribution and software archives.
|
|
11
|
-
|
|
12
|
-
== Key Characteristics
|
|
13
|
-
|
|
14
|
-
[cols="1,3"]
|
|
15
|
-
|===
|
|
16
|
-
|Property |Value
|
|
17
|
-
|
|
18
|
-
|Compression
|
|
19
|
-
|LZMA2 (with LZMA, BCJ filters)
|
|
20
|
-
|
|
21
|
-
|Encryption
|
|
22
|
-
|None
|
|
23
|
-
|
|
24
|
-
|Archive Support
|
|
25
|
-
|Single file only (use with TAR for multiple files)
|
|
26
|
-
|
|
27
|
-
|Large Files
|
|
28
|
-
|Yes (up to 4 EB)
|
|
29
|
-
|
|
30
|
-
|Best For
|
|
31
|
-
|Software packages, maximum compression, Unix systems
|
|
32
|
-
|===
|
|
33
|
-
|
|
34
|
-
== Basic Usage
|
|
35
|
-
|
|
36
|
-
=== Compress a File
|
|
37
|
-
|
|
38
|
-
[source,ruby]
|
|
39
|
-
----
|
|
40
|
-
# Compress single file with XZ
|
|
41
|
-
Omnizip.compress_file('data.bin', 'data.bin.xz',
|
|
42
|
-
level: 6 # Default level
|
|
43
|
-
)
|
|
44
|
-
|
|
45
|
-
# Maximum compression
|
|
46
|
-
Omnizip.compress_file('data.bin', 'data.bin.xz',
|
|
47
|
-
level: 9,
|
|
48
|
-
extreme: true # Use more CPU for slightly better ratio
|
|
49
|
-
)
|
|
50
|
-
----
|
|
51
|
-
|
|
52
|
-
=== Decompress a File
|
|
53
|
-
|
|
54
|
-
[source,ruby]
|
|
55
|
-
----
|
|
56
|
-
# Decompress XZ file
|
|
57
|
-
Omnizip.decompress_file('data.bin.xz', 'data.bin')
|
|
58
|
-
----
|
|
59
|
-
|
|
60
|
-
== XZ Utils Compatibility
|
|
61
|
-
|
|
62
|
-
Omnizip is compatible with files created by XZ Utils:
|
|
63
|
-
|
|
64
|
-
[source,bash]
|
|
65
|
-
----
|
|
66
|
-
# Create with XZ Utils
|
|
67
|
-
$ xz -k data.bin
|
|
68
|
-
|
|
69
|
-
# Extract with Omnizip
|
|
70
|
-
Omnizip.decompress_file('data.bin.xz', 'data.bin')
|
|
71
|
-
|
|
72
|
-
# Create with Omnizip
|
|
73
|
-
Omnizip.compress_file('data.bin', 'data.bin.xz')
|
|
74
|
-
|
|
75
|
-
# Extract with XZ Utils
|
|
76
|
-
$ xz -d data.bin.xz
|
|
77
|
-
----
|
|
78
|
-
|
|
79
|
-
== Compression Levels
|
|
80
|
-
|
|
81
|
-
[cols="1,2,2,2"]
|
|
82
|
-
|===
|
|
83
|
-
|Level |Memory (Compress) |Memory (Decompress) |Typical Use
|
|
84
|
-
|
|
85
|
-
|1-3
|
|
86
|
-
|4-24 MB
|
|
87
|
-
|1-3 MB
|
|
88
|
-
|Fast compression
|
|
89
|
-
|
|
90
|
-
|4-6
|
|
91
|
-
|32-96 MB
|
|
92
|
-
|4-9 MB
|
|
93
|
-
|**Default** - balanced
|
|
94
|
-
|
|
95
|
-
|7-9
|
|
96
|
-
|192-674 MB
|
|
97
|
-
|16-64 MB
|
|
98
|
-
|Maximum compression
|
|
99
|
-
|===
|
|
100
|
-
|
|
101
|
-
== TAR.XZ Archives
|
|
102
|
-
|
|
103
|
-
XZ is commonly combined with TAR:
|
|
104
|
-
|
|
105
|
-
[source,ruby]
|
|
106
|
-
----
|
|
107
|
-
# Create TAR.XZ archive
|
|
108
|
-
Omnizip.compress_directory('project/', 'project.tar.xz',
|
|
109
|
-
format: :tar_xz,
|
|
110
|
-
level: 6
|
|
111
|
-
)
|
|
112
|
-
----
|
|
113
|
-
|
|
114
|
-
== See Also
|
|
115
|
-
|
|
116
|
-
* link:../compression-algorithms/lzma2.html[LZMA2 Algorithm] - Compression details
|
|
117
|
-
* link:tar-format.html[TAR Format] - Multi-file archives with XZ
|
|
118
|
-
* link:gzip-format.html[GZIP Format] - Faster alternative
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: ZIP Format
|
|
3
|
-
nav_order: 2
|
|
4
|
-
parent: Archive Formats
|
|
5
|
-
grand_parent: Guides
|
|
6
|
-
---
|
|
7
|
-
|
|
8
|
-
== ZIP Format
|
|
9
|
-
|
|
10
|
-
=== General
|
|
11
|
-
|
|
12
|
-
The ZIP format is a widely used archive format.
|
|
13
|
-
|
|
14
|
-
=== Features
|
|
15
|
-
|
|
16
|
-
* Cross-platform compatibility
|
|
17
|
-
* ZIP64 support for large files
|
|
18
|
-
* Deflate compression
|
|
19
|
-
* WinZip AES encryption
|
|
20
|
-
|
|
21
|
-
=== Usage
|
|
22
|
-
|
|
23
|
-
[source,bash]
|
|
24
|
-
----
|
|
25
|
-
# Create ZIP archive
|
|
26
|
-
omnizip archive create backup.zip documents/ --format zip
|
|
27
|
-
|
|
28
|
-
# Extract ZIP archive
|
|
29
|
-
omnizip archive extract backup.zip output/
|
|
30
|
-
----
|
|
31
|
-
|
|
32
|
-
=== See Also
|
|
33
|
-
|
|
34
|
-
* link:../compression-algorithms/deflate.html[Deflate Algorithm]
|
|
35
|
-
|
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: BZip2
|
|
3
|
-
nav_order: 4
|
|
4
|
-
parent: Compression Algorithms
|
|
5
|
-
grand_parent: Guides
|
|
6
|
-
---
|
|
7
|
-
|
|
8
|
-
== Purpose
|
|
9
|
-
|
|
10
|
-
BZip2 is a compression algorithm based on the Burrows-Wheeler Transform (BWT) that provides excellent compression ratios for text files and source code. It's particularly effective for files with repetitive patterns.
|
|
11
|
-
|
|
12
|
-
== Key Characteristics
|
|
13
|
-
|
|
14
|
-
[cols="1,3"]
|
|
15
|
-
|===
|
|
16
|
-
|Property |Value
|
|
17
|
-
|
|
18
|
-
|Compression Ratio
|
|
19
|
-
|Very Good (better than Deflate)
|
|
20
|
-
|
|
21
|
-
|Compression Speed
|
|
22
|
-
|Medium
|
|
23
|
-
|
|
24
|
-
|Decompression Speed
|
|
25
|
-
|Medium
|
|
26
|
-
|
|
27
|
-
|Memory Usage
|
|
28
|
-
|Medium (dependent on block size)
|
|
29
|
-
|
|
30
|
-
|Best For
|
|
31
|
-
|Text files, source code, structured data
|
|
32
|
-
|===
|
|
33
|
-
|
|
34
|
-
== When to Use BZip2
|
|
35
|
-
|
|
36
|
-
**Choose BZip2 when**:
|
|
37
|
-
|
|
38
|
-
* Compressing text files or source code
|
|
39
|
-
* Need better compression than Deflate
|
|
40
|
-
* Working with structured data (XML, JSON, CSV)
|
|
41
|
-
* Compatibility with Unix/Linux systems is needed
|
|
42
|
-
|
|
43
|
-
**Consider alternatives when**:
|
|
44
|
-
|
|
45
|
-
* Speed is critical (use Zstandard)
|
|
46
|
-
* Maximum compression needed (use LZMA2)
|
|
47
|
-
* Binary data (use LZMA2)
|
|
48
|
-
|
|
49
|
-
== Basic Usage
|
|
50
|
-
|
|
51
|
-
=== Compress with BZip2
|
|
52
|
-
|
|
53
|
-
[source,ruby]
|
|
54
|
-
----
|
|
55
|
-
# Create BZip2-compressed file
|
|
56
|
-
Omnizip.compress_file('data.txt', 'data.txt.bz2',
|
|
57
|
-
algorithm: :bzip2,
|
|
58
|
-
level: 9
|
|
59
|
-
)
|
|
60
|
-
|
|
61
|
-
# Create archive with BZip2 compression
|
|
62
|
-
Omnizip::Archive.create('backup.7z', format: :seven_zip,
|
|
63
|
-
algorithm: :bzip2) do |archive|
|
|
64
|
-
archive.add_directory('project/')
|
|
65
|
-
end
|
|
66
|
-
----
|
|
67
|
-
|
|
68
|
-
=== Decompress BZip2
|
|
69
|
-
|
|
70
|
-
[source,ruby]
|
|
71
|
-
----
|
|
72
|
-
# Decompress BZip2 file
|
|
73
|
-
Omnizip.decompress_file('data.txt.bz2', 'data.txt')
|
|
74
|
-
|
|
75
|
-
# Extract BZip2 archive
|
|
76
|
-
Omnizip.extract_archive('backup.tar.bz2', 'output/')
|
|
77
|
-
----
|
|
78
|
-
|
|
79
|
-
== Compression Levels
|
|
80
|
-
|
|
81
|
-
BZip2 supports levels 1-9:
|
|
82
|
-
|
|
83
|
-
[cols="1,2,2,2"]
|
|
84
|
-
|===
|
|
85
|
-
|Level |Speed |Ratio |Best For
|
|
86
|
-
|
|
87
|
-
|1
|
|
88
|
-
|Fast
|
|
89
|
-
|Good
|
|
90
|
-
|Quick compression
|
|
91
|
-
|
|
92
|
-
|5
|
|
93
|
-
|Medium
|
|
94
|
-
|Very Good
|
|
95
|
-
|**Default** - balanced
|
|
96
|
-
|
|
97
|
-
|9
|
|
98
|
-
|Slow
|
|
99
|
-
|Best
|
|
100
|
-
|Maximum compression
|
|
101
|
-
|===
|
|
102
|
-
|
|
103
|
-
== Technical Details
|
|
104
|
-
|
|
105
|
-
* **Algorithm**: Burrows-Wheeler Transform + Move-to-Front + Huffman coding
|
|
106
|
-
* **Block Size**: 100KB to 900KB (level dependent)
|
|
107
|
-
* **File Extension**: `.bz2`
|
|
108
|
-
* **Container**: Can be used within TAR archives (`.tar.bz2` or `.tbz2`)
|
|
109
|
-
|
|
110
|
-
== See Also
|
|
111
|
-
|
|
112
|
-
* link:lzma.html[LZMA] - Better compression for general data
|
|
113
|
-
* link:deflate.html[Deflate] - Faster alternative
|
|
114
|
-
* link:../../compatibility.html[Compatibility] - BZip2 support across tools
|