Skip to content

bartkamphorst/tarchiver

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

42 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status Coverage Status Gem Version

Tarchiver

A high-level tar and tgz archiver. Designed for ease of use with acceptable memory footprint (reading and writing in blocks of configurable size).

Installation

Add this line to your application's Gemfile:

gem 'tarchiver'

And then execute:

$ bundle install

Or install it yourself as:

$ gem install tarchiver

Usage

Archiving

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)

Unarchiving

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)

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.

Custom Compressor

  1. Subclass Tarchiver::Compressor (MyCompressor < Tarchiver::Compressor)
  2. Implement compress and open class methods
  3. Set options[:compressor] to MyCompressor
  4. Profit

Contributing

  1. Fork it ( https://github.com/bartkamphorst/tarchiver/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

About

A high-level tar and tgz archiver.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages