Pure crystal tar archive reader

This shard makes you to read the TAR archive files(POSIX ustar format and some functions in GNUTAR fomat).

In this version, only following entry types are supported:

Installation

  1. Add the dependency to your shard.yml:

    dependencies:
      tarball:
        github: arcage/tarball.cr
  2. Run shards install

Usage

require "tarball"

# Extracts all files in "archive.tar" to under the "data" directory.
Tarball.extract_all("archive.tar", "data")

Tarball.open("archive.tar") do |tar|

  # list of included file system objects.
  tar.filenames
  #=> ["dir/", "dir/file_name.txt", "dir/image.png"]

  # extract specific file to specific path.
  tar.extract_file("dir/file_name.txt", "other_name.txt")

  # write content data to IO object.
  tar.write_content("dir/file_name.txt", STDOUT)
end

Contributors