Giter Site home page Giter Site logo

minitar's Introduction

Archive::Tar::Minitar README
============================
Archive::Tar::Minitar is a pure-Ruby library and command-line utility that
provides the ability to deal with POSIX tar(1) archive files. The
implementation is based heavily on Mauricio Ferna'ndez's implementation in
rpa-base, but has been reorganised to promote reuse in other projects.

This release is version 0.5.2, offering a Ruby 1.9 compatibility bugfix over
version 0.5.1. The library can only handle files and directories at this
point. A future version will be expanded to handle symbolic links and hard
links in a portable manner. The command line utility, minitar, can only create
archives, extract from archives, and list archive contents.

Using this library is easy. The simplest case is:

  require 'zlib'
  require 'archive/tar/minitar'
  include Archive::Tar

    # Packs everything that matches Find.find('tests')
  File.open('test.tar', 'wb') { |tar| Minitar.pack('tests', tar) }
    # Unpacks 'test.tar' to 'x', creating 'x' if necessary.
  Minitar.unpack('test.tar', 'x')

A gzipped tar can be written with:

    tgz = Zlib::GzipWriter.new(File.open('test.tgz', 'wb'))
      # Warning: tgz will be closed!
    Minitar.pack('tests', tgz)

    tgz = Zlib::GzipReader.new(File.open('test.tgz', 'rb'))
      # Warning: tgz will be closed!
    Minitar.unpack(tgz, 'x')

As the case above shows, one need not write to a file. However, it will
sometimes require that one dive a little deeper into the API, as in the case
of StringIO objects. Note that I'm not providing a block with Minitar::Output,
as Minitar::Output#close automatically closes both the Output object and the
wrapped data stream object.

  begin
    sgz = Zlib::GzipWriter.new(StringIO.new(""))
    tar = Output.new(sgz)
    Find.find('tests') do |entry|
      Minitar.pack_file(entry, tar)
    end
  ensure
      # Closes both tar and sgz.
    tar.close
  end

Copyright
=========
# Copyright 2004 Mauricio Julio Ferna'ndez Pradier and Austin Ziegler
#
# This program is based on and incorporates parts of RPA::Package from
# rpa-base (lib/rpa/package.rb and lib/rpa/util.rb) by Mauricio and has been
# adapted to be more generic by Austin.
#
# 'minitar' contains an adaptation of Ruby/ProgressBar by Satoru
# Takabayashi <[email protected]>, copyright 2001 - 2004.
#
# This program is free software. It may be redistributed and/or modified
# under the terms of the GPL version 2 (or later) or Ruby's licence.
# 
# $Id: README 213 2008-02-26 22:32:11Z austin $

minitar's People

Stargazers

Richard Apodaca avatar Jakob Skov-Pedersen avatar

Watchers

Richard Apodaca avatar James Cloos avatar  avatar

minitar's Issues

Directories are chmod'd with 777 permissions

I was just playing around with the library and a tar.gz file that regularly decompresses properly with directories having 755 permissions when using the tar command decompress with 777 permissions when using minitar.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.