compress_bundle: Compress entire bundle to tar

compress_bundleR Documentation

Compress entire bundle to tar

Description

Helper function wrapped around tar for easy compression of bundles.

Usage

compress_bundle(
  bundle_dir,
  dir_to,
  file_extension = ".tar",
  tar,
  extra_flags,
  ...
)

Arguments

bundle_dir

location of directory to compress; baton can be provided to automate the process.

dir_to

location to write the tar file; if baton provided this will default to the parent directory.

file_extension

character value; default set to '.tar'.

tar

parameter passed to tar; may require assigning to 'tar' manually if Sys.getenv('tar') has no value set.

extra_flags

parameter passed to tar; defaults to '-C' for the bundle_dir.

...

additional parameters passed to tar

Details

In the context of {relay}, compress_bundle() simplifies the process of compressing the bundle (see create_bundle) into a single object so it can be stored more efficiently or transferred across networks. When the baton object is provided, it will by default use the baton's unique-id within the bundle and place the tar file within the parent directory. This behavior can be overridden by manually providing the file path to bundle_dir parameter and the write location parameter dir_to. It is recommended to match the file_extension to the type of compression; for example, if compression = 'gzip', the extension should be '.tar.gz'.

Examples

## Not run: 
# Create a bundled baton
my_baton <- create_baton(bundled = TRUE,
                         bundle_params = list(dir = file.path('path', 'to', 'save', 'yaml'),
                                              tree = c('subdir1', 'subdir2', 'subdir3')))

# Compress based upon baton
compress_bundle(my_baton, tar = 'tar', file_extension = '.tar.gz', compression = 'gzip')

# Compress based upon bundle directory
compress_bundle('path/to/location/to/tar', tar = 'tar', file_extension = '.tar.gz', compression = 'gzip')

# Uncompress: use normal method:
untar("path/to/nameoftarfile.tar.gz", exdir ="/unzip/location", tar = 'TAR')

## End(Not run)

al-obrien/relay documentation built on May 6, 2023, 10:19 p.m.