A high-level tar and tgz archiver. Designed for ease of use with acceptable memory footprint (reading and writing in blocks of configurable size).
Add this line to your application's Gemfile:
gem 'tarchiver'
And then execute:
$ bundle install
Or install it yourself as:
$ gem install tarchiver
Tarchiver::Archiver.archive(archive_dir) # outputs archive to working directory
# Returns archive path on success and nil on failure, unless options[:raise_errors] is enabled
Tarchiver::Archiver.archive(archive_dir, output_dir, options)
Tarchiver::Archiver.unarchive(archive_path) # outputs output to working directory
# Returns output path on success and nil on failure, unless options[:raise_errors] is enabled
Tarchiver::Archiver.unarchive(archive_path, unpack_path, options)
{
delete_input_on_success: false,
blocksize: 1024000,
verbose: false,
content_only: false,
relative_to_top_dir: true,
custom_archive_name: nil,
archive_type: :tgz,
compressor: Tarchiver::Gzipper,
add_timestamp: false,
raise_errors: false
}
See Tarchiver::Constants.
- Subclass Tarchiver::Compressor (MyCompressor < Tarchiver::Compressor)
- Implement
compress
andopen
class methods - Set options[:compressor] to MyCompressor
- Profit
- Fork it ( https://github.com/bartkamphorst/tarchiver/fork )
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request