53tar Module

53.1Overview

The tar module provides measures to read/write TAR files. To utilize it, import the tar module using import function.

53.2tar.reader Class

53.2.1Function To Create Instance

tar.reader(stream:stream:r, compression?:symbol) {block?}

Reads a tar file from stream and returns a tar.reader instance that is to be used to read contents from the archive.

The argument compression specifies the compression format of the tar file and takes one of the following symbols:

  • `auto .. determins the format from a suffix name of the stream.
  • `gzip .. gzip format
  • `bzip2 .. bzip2 format

53.2.2Method

tar.reader#entries() {block?}
Creates an iterator that returns stream instances for each entry in the tar file.

53.3tar.writer Class

53.3.1Function To Create Instance

tar.writer(stream:stream:w, compression?:symbol) {block?}

Creates a tar file on stream and returns a tar.writer instance that is to be used to write contents to the archive.

The argument compression specifies the compression format of the tar file and takes one of the following symbols:

  • `auto .. determins the format from a suffix name of the stream.
  • `gzip .. gzip format
  • `bzip2 .. bzip2 format

53.3.2Method

tar.writer#add(stream:stream:r, filename?:string):map:reduce

Adds an entry to the tar archive with a content from stream and a name of filename.

If the argument filename is omitted, an identifier associated with the stream would be used as the entry name.

tar.writer#close():reduce
Flushes all the unfinished writing processes and invalidates the tar.writer instance.

53.4Thanks

This module uses zlib and bzip2 library which are distributed in the following sites: