forthebadge forthebadge Gem Version


Scope of Extracter

The scope (and goals) for class Extracter are really simple: throw any archive format at it, and the class will try to extract it.

It can be used on the commandline as well.

How to find out whether a given file is a valid archive

You can find out whether given input xyz is a valid archive by issuing the following toplevel-method:


This will return either true or false.

How to extract an archive through class Extracter, in pure ruby

You can use the following method to extract an archive, into a specific target location:

Extracter.extract_what_to('foo-1.0.tar.xz', '/tmp')

The first argument is the local path to an archive. The second argument specifies the target, usually the target directory.

Colour support

If the Colours gem (gem install colours) is available then colour support is possible for class Extracter. For the class, the instance variable @use_colours determines this. If you do not want to have colours then you can disable this, e. g. through the method call .disable_colours to give one example for doing so.

What archives and files can be extracted?

class Extracter can extract .tar.xz,, .tar.gz, tar.Z, .zip and numerous more file formats. This requires that tools such as tar or gzip or xz are installed and available on the target computer-machine.

It can also extract audio-files if ffmpeg is installed and the multimedia_paradise project is available (gem install multimedia_paradise), as well as squashfs files (typically .img files). In the latter case, such an .img file will be mounted in the current directory.

Contact information

If you have specific suggestions to make this gem more useful for others, please drop me an email at:

(Please keep in mind that responding to emails may take a while depending on the amount of work I may have at that moment in time due to reallife.)

Thank you.