gcs_save_all: Save/Load all files in directory to Google Cloud Storage

Description Usage Arguments Details Value See Also Examples

View source: R/rsession.R

Description

This function takes all the files in the directory, zips them, and saves/loads/deletes them to the cloud. The upload name will be the directory name.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
gcs_save_all(
  directory = getwd(),
  bucket = gcs_get_global_bucket(),
  pattern = "",
  predefinedAcl = c("private", "bucketLevel", "authenticatedRead",
    "bucketOwnerFullControl", "bucketOwnerRead", "projectPrivate", "publicRead",
    "default")
)

gcs_load_all(
  directory = getwd(),
  bucket = gcs_get_global_bucket(),
  exdir = directory,
  list = FALSE
)

gcs_delete_all(directory = getwd(), bucket = gcs_get_global_bucket())

Arguments

directory

The folder to upload/download

bucket

Bucket to store within

pattern

An optional regular expression. Only file names which match the regular expression will be saved.

predefinedAcl

Specify user access to object. Default is 'private'. Set to 'bucketLevel' for buckets with bucket level access enabled.

exdir

When downloading, specify a destination directory if required

list

When downloading, only list where the files would unzip to

Details

Zip/unzip is performed before upload and after download using zip.

Value

When uploading the GCS meta object; when downloading TRUE if successful

See Also

Other R session data functions: gcs_load(), gcs_save_image(), gcs_save(), gcs_source()

Examples

1
2
3
4
5
6
7
8
## Not run: 

gcs_save_all(
  directory = "path-to-all-images",
  bucket = "my-bucket",
  predefinedAcl = "bucketLevel")

## End(Not run)

googleCloudStorageR documentation built on Dec. 16, 2021, 5:06 p.m.