Skip to content

Commit

Permalink
Add roxygen headers to functions
Browse files Browse the repository at this point in the history
  • Loading branch information
thisisnic committed Aug 1, 2023
1 parent 212a8dd commit a1aaf80
Showing 1 changed file with 42 additions and 5 deletions.
47 changes: 42 additions & 5 deletions r/R/filesystem.R
Original file line number Diff line number Diff line change
Expand Up @@ -684,21 +684,40 @@ read_file_utf8 <- function(file) {
res
}

#' List files in a file system
#'
#' @param fs A FileSystem object
#' @param path A character vector of one or more paths
#' @param ... Additional arguments passed to [FileSelector$create()]
#' @export
fs_ls <- function(fs, path, ...){
fs_ls <- function(fs, path = ".", ...){
fs$ls(path, ...)
}

#' Create a file in a file system
#'
#' @param fs A FileSystem object
#' @param path A character vector of one or more paths
#' @param recursive Create intermediate directories if they do not exist
#' @export
fs_create_dir <- function(fs, path, recursive = TRUE){
fs$CreateDir(path, recursive = recursive)
}

#' Delete a file in a file system
#'
#' @param fs A FileSystem object
#' @param path A character vector of one or more paths
#' @export
fs_delete_dir <- function(fs, path){
fs$DeleteDir(path)
}

#' Copy a file in a file system
#'
#' @param fs A FileSystem object
#' @param src Source path
#' @param dest Destination path
#' @export
fs_copy_file <- function(fs, src, dest){
fs$CopyFile(src, dest)
Expand All @@ -715,21 +734,39 @@ fs_open_output_stream <- function(fs, path, append = FALSE){

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

#' Delete a file from a file system
#'
#' @param fs A FileSystem object
#' @param path A character vector of one or more paths
#' @export
fs_delete_file <- function(fs, paths){
fs$DeleteFiles(paths)
fs_delete_file <- function(fs, path){
fs$DeleteFiles(path)
}

#' Get file metadata
#'
#' @param fs A FileSystem object
#' @param path A character vector of one or more paths
#' @export
fs_get_file_info <- function(fs, paths){
fs$GetFileInfo(paths)
fs_get_file_info <- function(fs, path){
fs$GetFileInfo(path)
}

#' @export
fs_make_path <- function(fs, path){
fs$path(path)
}

#' Move or rename a file in a file system
#'
#' Move / rename a file or directory. If the destination exists:
#' * if it is a non-empty directory, an error is returned
#' * otherwise, if it has the same type as the source, it is replaced
#' * otherwise, behavior is unspecified (implementation-dependent).
#'
#' @param fs A FileSystem object
#' @param src Source path
#' @param dest Destination path
#' @export
fs_move_file <- function(fs, src, dest){
fs$Move(src, dest)
Expand Down

0 comments on commit a1aaf80

Please sign in to comment.