get_bucket: List bucket contents

Description Usage Arguments Details Value References See Also Examples

View source: R/get_bucket.R

Description

List the contents of an S3 bucket as either a list or data frame

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
get_bucket(
  bucket,
  prefix = NULL,
  delimiter = NULL,
  max = NULL,
  marker = NULL,
  parse_response = TRUE,
  ...
)

get_bucket_df(
  bucket,
  prefix = NULL,
  delimiter = NULL,
  max = NULL,
  marker = NULL,
  ...
)

Arguments

bucket

Character string with the name of the bucket, or an object of class “s3_bucket”.

prefix

Character string that limits the response to keys that begin with the specified prefix

delimiter

Character string used to group keys. Read the AWS doc for more detail.

max

Integer indicating the maximum number of keys to return. The function will recursively access the bucket in case max > 1000. Use max = Inf to retrieve all objects.

marker

Character string that specifies the key to start with when listing objects in a bucket. Amazon S3 returns object keys in alphabetical order, starting with key after the marker in order.

parse_response

logical, should we attempt to parse the response?

...

Additional arguments passed to s3HTTP.

Details

From the AWS doc: “This implementation of the GET operation returns some or all (up to 1000) of the objects in a bucket. You can use the request parameters as selection criteria to return a subset of the objects in a bucket.” The max and marker arguments can be used to retrieve additional pages of results. Values from a call are store as attributes

Value

get_bucket returns a list of objects in the bucket (with class “s3_bucket”), while get_bucket_df returns a data frame (the only difference is the application of the as.data.frame() method to the list of bucket contents. If max is greater than 1000, multiple API requests are executed and the attributes attached to the response object reflect only the final request.

References

API Documentation

See Also

bucketlist, get_object

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
## Not run: 
  # basic usage
  b <- bucketlist()
  get_bucket(b[1,1])
  get_bucket_df(b[1,1])

  # bucket names with dots
  ## this (default) should work:
  get_bucket("this.bucket.has.dots", url_style = "path")
  ## this probably wont:
  #get_bucket("this.bucket.has.dots", url_style = "virtual")

## End(Not run)

aws.s3 documentation built on April 14, 2020, 5:15 p.m.