Skip to content

Instantly share code, notes, and snippets.

@akdubya
Created March 19, 2009 21:53
Show Gist options
  • Save akdubya/82090 to your computer and use it in GitHub Desktop.
Save akdubya/82090 to your computer and use it in GitHub Desktop.
require 'rubygems'
require 'archive/tar/minitar'
src = {
"foo.txt" => "This is file foo",
"bar.txt" => "This is file bar",
}
File.open("test.tar","w") do |tarfile|
Archive::Tar::Minitar::Writer.open(tarfile) do |tar|
src.each do |name, data|
tar.add_file_simple(name, :size=>data.size, :mode=>0644) { |f|
f.write(data) }
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment