AzureStor (version 2.0.1)

storage_upload: Upload and download generics

Description

Upload and download generics

Usage

storage_upload(container, ...)

# S3 method for blob_container storage_upload(container, src, dest, ...)

# S3 method for file_share storage_upload(container, src, dest, ...)

# S3 method for adls_filesystem storage_upload(container, src, dest, ...)

storage_multiupload(container, ...)

# S3 method for blob_container storage_multiupload(container, src, dest, ...)

# S3 method for file_share storage_multiupload(container, src, dest, ...)

# S3 method for adls_filesystem storage_multiupload(container, src, dest, ...)

storage_download(container, ...)

# S3 method for blob_container storage_download(container, src, dest, ...)

# S3 method for file_share storage_download(container, src, dest, ...)

# S3 method for adls_filesystem storage_download(container, src, dest, ...)

storage_multidownload(container, ...)

# S3 method for blob_container storage_multidownload(container, src, dest, ...)

# S3 method for file_share storage_multidownload(container, src, dest, ...)

# S3 method for adls_filesystem storage_multidownload(container, src, dest, ...)

download_from_url(src, dest, key = NULL, token = NULL, sas = NULL, ..., overwrite = FALSE)

upload_to_url(src, dest, key = NULL, token = NULL, sas = NULL, ...)

Arguments

container

A storage container object.

...

Further arguments to pass to lower-level functions.

src, dest

The source and destination files to transfer.

key, token, sas

Authentication arguments: an access key, Azure Active Directory (AAD) token or a shared access signature (SAS). If multiple arguments are supplied, a key takes priority over a token, which takes priority over a SAS. For upload_to_url and download_to_url, you can also provide a SAS as part of the URL itself.

overwrite

For downloading, whether to overwrite any destination files that exist.

Details

These functions allow you to transfer files to and from a storage account.

storage_upload, storage_download, storage_multiupload and storage_multidownload take as first argument a storage container, either for blob storage, file storage, or ADLSgen2. They dispatch to the corresponding file transfer functions for the given storage type.

upload_to_url and download_to_url allow you to transfer a file to or from Azure storage, given the URL of the source or destination. The storage details (endpoint, container name, and so on) are obtained from the URL.

By default, storage_download and download_from_url will display a progress bar while they are downloading. To turn this off, use options(azure_dl_progress_bar=FALSE). To turn the progress bar back on, use options(azure_dl_progress_bar=TRUE).

See Also

storage_container, blob_container, file_share, adls_filesystem

download_blob, download_azure_file, download_adls_file, call_azcopy

Examples

Run this code
# NOT RUN {
# download from blob storage
bl <- storage_endpoint("https://mystorage.blob.core.windows.net/", key="access_key")
cont <- storage_container(bl, "mycontainer")
storage_download(cont, "bigfile.zip", "~/bigfile.zip")

# same download but directly from the URL
download_from_url("https://mystorage.blob.core.windows.net/mycontainer/bigfile.zip",
                  "~/bigfile.zip",
                  key="access_key")

# upload to ADLSgen2
ad <- storage_endpoint("https://myadls.dfs.core.windows.net/", token=mytoken)
cont <- storage_container(ad, "myfilesystem")
create_storage_dir(cont, "newdir")
storage_upload(cont, "files.zip", "newdir/files.zip")

# same upload but directly to the URL
upload_to_url("files.zip",
              "https://myadls.dfs.core.windows.net/myfilesystem/newdir/files.zip",
              token=mytoken)

# }

Run the code above in your browser using DataLab