Skip to content

Commit

Permalink
Add new wrapper functions
Browse files Browse the repository at this point in the history
  • Loading branch information
thisisnic committed Jul 24, 2023
1 parent a9f100c commit a2540cb
Showing 1 changed file with 51 additions and 0 deletions.
51 changes: 51 additions & 0 deletions r/R/filesystem.R
Original file line number Diff line number Diff line change
Expand Up @@ -683,3 +683,54 @@ read_file_utf8 <- function(file) {
Encoding(res) <- "UTF-8"
res
}

#' @export
s3_ls <- function(bucket, path, ...){
bucket$ls(path, ...)
}

#' @export
s3_dir_create <- function(bucket, path, recursive = TRUE){
bucket$CreateDir(path, recursive = recursive)
}

#' @export
s3_dir_delete <- function(bucket, path){
bucket$DeleteDir(path)
}

#' @export
s3_file_copy <- function(bucket, src, dest){
bucket$CopyFile(src, dest)
}

#' @export
s3_output_stream <- function(bucket, path, append = FALSE){
if (append) {
bucket$OpenAppendStream(path)
} else {
bucket$OpenOutputStream(path)
}
}

# TODO: create method close.OutputStream (or whatever object returned from bucket$OpenAppendStream)

#' @export
s3_file_delete <- function(bucket, paths){
bucket$DeleteFiles(paths)
}

#' @export
s3_file_info <- function(bucket, paths){
bucket$GetFileInfo(paths)
}

#' @export
s3_path <- function(bucket, path){
bucket$path(path)
}

#' @export
s3_file_move <- function(bucket, src, dest){
bucket$Move(src, dest)
}

0 comments on commit a2540cb

Please sign in to comment.