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.
- http://rubyzip.sourceforge.net
On 5/1/06, Victor S. [email protected] 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
On 5/2/06, Victor S. [email protected] 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,