bb_decompress: Postprocessing: decompress zip, gz, bz2, tar, Z files and...

View source: R/postprocess.R

bb_decompressR Documentation

Postprocessing: decompress zip, gz, bz2, tar, Z files and optionally delete the compressed copy

Description

Functions for decompressing files after downloading. These functions are not intended to be called directly, but rather are specified as a postprocess option in bb_source. bb_unzip, bb_untar, bb_gunzip, bb_bunzip2, and bb_uncompress are convenience wrappers around bb_decompress that specify the method.

Usage

bb_decompress(method, delete = FALSE, ...)

bb_unzip(...)

bb_gunzip(...)

bb_bunzip2(...)

bb_uncompress(...)

bb_untar(...)

Arguments

method

string: one of "unzip", "gunzip", "bunzip2", "decompress", "untar"

delete

logical: delete the zip files after extracting their contents?

...

: extra parameters passed automatically by bb_sync

Details

Tar files can be compressed (i.e. file extensions .tar, .tgz, .tar.gz, .tar.bz2, or .tar.xz). Support for tar files may depend on your platform (see untar).

If the data source delivers compressed files, you will most likely want to decompress them after downloading. These functions will do this for you. By default, these do not delete the compressed files after decompressing. The reason for this is so that on the next synchronization run, the local (compressed) copy can be compared to the remote compressed copy, and the download can be skipped if nothing has changed. Deleting local compressed files will save space on your file system, but may result in every file being re-downloaded on every synchronization run.

Value

list with components status (TRUE on success), files (character vector of paths to extracted files), and deleted_files (character vector of paths of files that were deleted)

See Also

bb_source, bb_config, bb_cleanup

Examples

## Not run: 
  ## decompress .zip files after synchronization but keep zip files intact
  my_source <- bb_source(..., postprocess = list("bb_unzip"))

  ## decompress .zip files after synchronization and delete zip files
  my_source <- bb_source(..., postprocess = list(list("bb_unzip", delete = TRUE)))

## End(Not run)


AustralianAntarcticDivision/bowerbird documentation built on March 8, 2024, 8:33 a.m.