---------- Forwarded message ----------
From: Simon M. [email protected]
Date: Sep 27, 2007 4:16 PM
Subject: minitar - how to extract only one file from a tar archive as an
To: [email protected]
Ahoy there, fellow rubyphiles…
I’m trying to use Archive::Tar::Minitar to extract a single file from
a tar archive:
# lifted from the minitar source... require 'archive/tar/minitar' include Archive::Tar
a = File.open(“test.tar”, “rb”)
Minitar::Input.open(a) do |inp|
inp.each do |entry|
inp.extract_entry(“.”, entry) if entry.full_name =~ /baz/
This all works fine, and writes to “./test/baz”
How could I do the same and create a File object of the extracted
file? (i.e. not write anything to disk).
(The reason I ask is the file I want is a zip, which lives inside the
tar archive and I then want to grab some files from that using the
It’s quite possible (in fact, more than likely) that I’ve missed
something obvious and there is already a straightforward way to do
To be honest, a few more examples of minitar in use would be great.
Many thanks in advance for any pointers or tips.