diff --git a/NAMESPACE b/NAMESPACE index 0417ffe..16453bc 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -11,27 +11,27 @@ export(change_lease) export(create_azure_dir) export(create_blob_container) export(create_file_share) -export(delete_azure_blob) export(delete_azure_dir) export(delete_azure_file) +export(delete_blob) export(delete_blob_container) export(delete_file_share) -export(download_azure_blob) export(download_azure_file) +export(download_blob) export(download_from_url) export(file_share) export(get_azure_blob_properties) export(get_azure_dir_properties) export(get_azure_file_properties) export(get_storage_properties) -export(list_azure_blobs) export(list_azure_files) export(list_blob_containers) +export(list_blobs) export(list_file_shares) export(release_lease) export(renew_lease) export(storage_endpoint) -export(upload_azure_blob) export(upload_azure_file) +export(upload_blob) export(upload_to_url) import(AzureRMR) diff --git a/R/blob_client_funcs.R b/R/blob_client_funcs.R index 6ca289f..e0111a7 100644 --- a/R/blob_client_funcs.R +++ b/R/blob_client_funcs.R @@ -69,7 +69,7 @@ delete_blob_container <- function(container, confirm=TRUE, lease=NULL) #' @export -list_azure_blobs <- function(container) +list_blobs <- function(container) { lst <- do_container_op(container, options=list(comp="list", restype="container")) unname(vapply(lst$Blobs, function(b) b$Name[[1]], FUN.VALUE=character(1))) @@ -77,7 +77,7 @@ list_azure_blobs <- function(container) #' @export -upload_azure_blob <- function(container, src, dest, type="BlockBlob") +upload_blob <- function(container, src, dest, type="BlockBlob") { # TODO: upload in chunks body <- readBin(src, "raw", file.info(src)$size) @@ -94,14 +94,14 @@ upload_azure_blob <- function(container, src, dest, type="BlockBlob") #' @export -download_azure_blob <- function(container, src, dest, overwrite=FALSE) +download_blob <- function(container, src, dest, overwrite=FALSE) { do_container_op(container, src, config=httr::write_disk(dest, overwrite)) } #' @export -delete_azure_blob <- function(container, blob, confirm=TRUE) +delete_blob <- function(container, blob, confirm=TRUE) { if(confirm && interactive()) { diff --git a/R/file_client_funcs.R b/R/file_client_funcs.R index 4a99adc..3f28c3f 100644 --- a/R/file_client_funcs.R +++ b/R/file_client_funcs.R @@ -60,10 +60,18 @@ delete_file_share <- function(share, confirm=TRUE) #' @export -list_azure_files <- function(share, dir) +list_azure_files <- function(share, dir, all_info=TRUE) { lst <- do_container_op(share, dir, options=list(comp="list", restype="directory")) - unname(vapply(lst$Entries, function(b) b$Name[[1]], FUN.VALUE=character(1))) + + name <- sapply(lst$Entries, function(ent) ent$Name[[1]]) + if(!all_info) + return(name) + + size <- sapply(lst$Entries, + function(ent) if(is_empty(ent$Properties)) NA else ent$Properties$`Content-Length`[[1]]) + + data.frame(name=name, type=names(lst$Entries), size=as.numeric(size), stringsAsFactors=FALSE) }