# "All-in-one" archives library?

**URL:** <https://www.ruby-forum.com/t/all-in-one-archives-library/59372>\
**Category:** Ruby\
**Created:** [May 3, 2006, 6:59pm UTC](https://www.ruby-forum.com/t/all-in-one-archives-library/59372 "2006-05-03T18:59:03Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![victor123789](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/v/f0a364/32.png) [@victor123789](https://www.ruby-forum.com/u/victor123789)\
**Post date:** [May 3, 2006, 6:59pm UTC](https://www.ruby-forum.com/t/all-in-one-archives-library/59372/1 "2006-05-03T18:59:03Z")

</div>

Hi all.

I’d like to see some library which handles most popular archive types  
(zip,  
rar, tar, gz, bz2 …) in uniform way, just like rubyzip[1] does:

require ‘some-very-cool-library’

Dir[‘myarchive.zip’].each …

Or even

Dir[‘myarchive.zip/otherone.rar/evenother.bz2’].each …

Is something like this exists in the world?

Thanks.

Victor.

1. [http://rubyzip.sourceforge.net](http://rubyzip.sourceforge.net)

---

<div class="post-metadata">

**Author:** ![victor123789](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/v/f0a364/32.png) [@victor123789](https://www.ruby-forum.com/u/victor123789)\
**Post date:** [May 3, 2006, 6:59pm UTC](https://www.ruby-forum.com/t/all-in-one-archives-library/59372/2 "2006-05-03T18:59:09Z")

</div>

On 5/1/06, Victor S. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Is something like this exists in the world?

Can you drop me an email with what you’d really like to see? TRUG is  
working on libarchive this weekend at a hackathon.

-austin

---

<div class="post-metadata">

**Author:** ![victor123789](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/v/f0a364/32.png) [@victor123789](https://www.ruby-forum.com/u/victor123789)\
**Post date:** [May 3, 2006, 6:59pm UTC](https://www.ruby-forum.com/t/all-in-one-archives-library/59372/3 "2006-05-03T18:59:23Z")

</div>

On 5/2/06, Victor S. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Hi all.
> 
> I’d like to see some library which handles most popular archive types  
> (zip,  
> rar, tar, gz, bz2 …) in uniform way, just like rubyzip[1] does:

At the moment, there’s archive-tar-external, which basically wraps calls  
to  
installed software with popen. So, if you have all these tools  
installed  
already, you can do something like:

```
  require 'archive/tar_external'

  t = Archive::Tar::External.new( name )
  t.compressed_archive_name = name
  if name =~ /\.bz2/
    t.uncompress( "bunzip2" )
  elsif name =~ /\.gz/
    t.uncompress( "gunzip" )
  elsif name =~ /\.zip/
    t.uncompress( "unzip" )
  end
  if name =~ /\.t(ar\.)?(gz)?/
    t.extract
  end

```

HTH,

- Dimitri
