tarInfo: Get table of contents of a gzipped tar file

Description Usage Arguments Value Author(s) References See Also Examples

View source: R/Rtar.R

Description

This function reads a gzipped tar file and, by default, returns information about each entry in the archive. As the archive is being read, when an entry is encountered a callback function (in R) or (C) routine is invoked giving details about the entry. One can pass an R function to be invoked or the address of a C routine. The R function should accept arguments giving the name of the file (character string), entryType (character string), the time stamp on the entry (number of seconds from Jan 1, 1970 00:00), and the size. The last argument is a counter and should be ignored. It will be removed.

Usage

1
tarInfo(filename, fun = tarListCallback(), data = NULL)

Arguments

filename

the name of the gzipped tar file

fun

a function that is invoked for each entry in the archive as it is encountered with the entry name, type, time stamp and size. This can also be a list of functions with class TarInfoCallback with elements named callback and .ans. One can also provide a native (C) routine to be invoked using getNativeSymbolInfo(sym_name)$addres.

data

an object that is passed to a a native routine passed via fun. If that argument is not a routine, then this is ignored.

Value

By default, the result is a data frame with a row for each entry in the archive and with columns file, type, timestamp and size. If one specifies a value for fun, the return value is fun itself in the expectation that one can use that to get the result.

Author(s)

Duncan Temple Lang using code in contrib/untgz/ from the zlib-1.2.3 distribution that was writtent by Pedro A. Aranda Gutierrez <paag@tid.es>, adapted to Unix by Jean-loup Gailly <jloup@gzip.org> and with various fixes by Cosmin Truta <cosmint@cs.ubbcluj.ro>.

References

zlib/contrib/untgz in the zlib-1.2.3 distribution.

See Also

tarExtract

Examples

1
2
  filename = system.file("sampleData", "OmegahatXSL_0.2-0.tar.gz", package = "Rcompression")
  tarInfo(filename)

statwonk/Rcompression documentation built on May 30, 2019, 10:43 a.m.