better file listing, rename again

This commit is contained in:
hong-revo 2018-05-17 06:58:34 +10:00
Родитель ad69081bb3
Коммит c93db9219c
3 изменённых файлов: 18 добавлений и 10 удалений

Просмотреть файл

@ -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)

Просмотреть файл

@ -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())
{

Просмотреть файл

@ -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)
}