aws.s3 (version 0.3.12)

get_bucket: List bucket contents

Description

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

Usage

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 pecifies 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.

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.

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

References

API Documentation

See Also

bucketlist, get_object

Examples

Run this code
# 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")
# }
# NOT RUN {
# }

Run the code above in your browser using DataCamp Workspace