All Projects → Quintus → ruby-xz

Quintus / ruby-xz

Licence: other
Ruby bindings for liblzma, using fiddle

Programming Languages

ruby
36898 projects - #4 most used programming language

Projects that are alternatives of or similar to ruby-xz

box
Box - Open Standard Archive Format, a zip killer.
Stars: ✭ 38 (+15.15%)
Mutual labels:  compression, xz
ratarmount
Random Access Read-Only Tar Mount
Stars: ✭ 217 (+557.58%)
Mutual labels:  compression, xz
PLzmaSDK
PLzmaSDK is (Portable, Patched, Package, cross-P-latform) Lzma SDK.
Stars: ✭ 28 (-15.15%)
Mutual labels:  compression, xz
em inflate
Fast, small, in-memory inflate (zlib, deflate and gzip decompression)
Stars: ✭ 59 (+78.79%)
Mutual labels:  compression
ConvectionKernels
Fast, high-quality texture compression library for many formats
Stars: ✭ 40 (+21.21%)
Mutual labels:  compression
snappy
Fastest Snappy compression library in Node.js
Stars: ✭ 110 (+233.33%)
Mutual labels:  compression
gorilla
An effective time-series data compression/decompression method based on Facebook's Gorilla.
Stars: ✭ 51 (+54.55%)
Mutual labels:  compression
Compressai
A PyTorch library and evaluation platform for end-to-end compression research
Stars: ✭ 246 (+645.45%)
Mutual labels:  compression
Turbo-Transpose
Transpose: SIMD Integer+Floating Point Compression Filter
Stars: ✭ 50 (+51.52%)
Mutual labels:  compression
php-closure-compiler
A PHP Library to use Google Closure Compiler compress Javascript
Stars: ✭ 20 (-39.39%)
Mutual labels:  compression
Guetzling
Guetzling is a simple script for macOS and Linux written in Bash, to automate (recursively finding files) the compression of jpegs using the Guetzli algorithm.
Stars: ✭ 20 (-39.39%)
Mutual labels:  compression
GenuineChannels
Collection of custom .NET Remoting channels
Stars: ✭ 29 (-12.12%)
Mutual labels:  compression
levi-db
levi-db is a fast database engine
Stars: ✭ 37 (+12.12%)
Mutual labels:  compression
Huffman-Coding
A C++ compression program based on Huffman's lossless compression algorithm and decoder.
Stars: ✭ 81 (+145.45%)
Mutual labels:  compression
xcdat
Fast compressed trie dictionary library
Stars: ✭ 51 (+54.55%)
Mutual labels:  compression
Precomp Cpp
Precomp, C++ version - further compress already compressed files
Stars: ✭ 250 (+657.58%)
Mutual labels:  compression
GainedVAE
A Pytorch Implementation of a continuously rate adjustable learned image compression framework.
Stars: ✭ 43 (+30.3%)
Mutual labels:  compression
FrameOfReference
C++ library to pack and unpack vectors of integers having a small range of values using a technique called Frame of Reference
Stars: ✭ 36 (+9.09%)
Mutual labels:  compression
roadroller
Roadroller: Flattens Your JavaScript Demo
Stars: ✭ 253 (+666.67%)
Mutual labels:  compression
wordpress-plugin
Speed up your WordPress website. Optimize your JPEG and PNG images automatically with TinyPNG.
Stars: ✭ 78 (+136.36%)
Mutual labels:  compression

Project has new maintainer

As of 2021, I needed to abandon this project. I moved on to other things and was unable maintain it any further. Luckily, GitHub user @win93 has kindly taken over maintenance over ruby-xz. The new repository for ruby-xz is here: https://github.com/win93/ruby-xz Please file any tickets or pull request at that repository. @win93 has also taken over the ruby-xz RubyGem with my permission.

This repository only remains for historical and archival purposes. Thanks to @win93 for taking over ruby-xz.

ruby-xz

ruby-xz is a basic binding to the famous liblzma library, best known for the extreme compression-ratio it's native XZ format achieves. ruby-xz gives you the possibility of creating and extracting XZ archives on any platform where liblzma is installed. No compilation is needed, because ruby-xz is written on top of Ruby's “fiddle” library (part of the standard libary). ruby-xz does not have any dependencies other than Ruby itself.

ruby-xz supports both “intuitive” (de)compression by providing methods to directly operate on strings and files, but also allows you to operate directly on IO streams (see the various methods of the XZ module). On top of that, ruby-xz offers an advanced interface that allows you to treat XZ-compressed data as IO streams, both for reading and for writing. See the XZ::StreamReader and XZ::StreamWriter classes for more information on this.

Note: Version 1.0.0 breaks the API quite heavily. Refer to HISTORY.rdoc for details.

Installation

Install it the way you install all your gems.

$ gem install ruby-xz

Alternatively, you can clone the repository and build the most recent code yourself:

$ git clone git://git.guelker.eu/ruby-xz.git
$ cd ruby-xz
$ rake gem
$ gem install pkg/ruby-xz-*.gem

Usage

The documentation of the XZ module is well and you should be able to find everything you need to use ruby-xz. As said, it's not big, but powerful: You can create and extract whole archive files, compress or decompress streams of data or just plain strings.

You can read the documentation on your local gemserver, or browse it online.

Require

You have to require the “xz.rb” file:

require "xz"

Examples

# Compress a file
XZ.compress_file("myfile.txt", "myfile.txt.xz")
# Decompress it
XZ.decompress_file("myfile.txt.xz", "myfile.txt")

# Compress everything you get from a socket (note that there HAS to be a EOF
# sometime, otherwise this will run infinitely)
XZ.compress_stream(socket){|chunk| opened_file.write(chunk)}

# Compress a string
comp = XZ.compress("Mydata")
# Decompress it
data = XZ.decompress(comp)

Have a look at the XZ module's documentation for an in-depth description of what is possible.

Usage with the minitar gem

ruby-xz can be used together with the minitar library (formerly “archive-tar-minitar”) to create XZ-compressed tarballs. This works by employing the IO-like classes XZ::StreamReader and XZ::StreamWriter analogous to how one would use Ruby's “zlib” library together with “minitar”. Example:

require "xz"
require "minitar"

# Create an XZ-compressed tarball
XZ::StreamWriter.open("tarball.tar.xz") do |txz|
  Minitar.pack("path/to/directory", txz)
end

# Unpack it again
XZ::StreamReader.open("tarball.tar.xz") do |txz|
  Minitar.unpack(txz, "path/to/target/directory")
end

Links

License

MIT license; see LICENSE for the full license text.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].