Azure Blob Container file download

Viewed 1439

I need to download CSV file from Azure Storage Account, Are there any ways to download the file(CSV) using java SDK or rest API? what API's need to be used?

1 Answers

You can use the Azure Storage SDK for java . To download a file, you just need to use the class CloudBlockBlob which should look like,

// Download the blob to a local file
// Append the string "DOWNLOAD" before the .txt extension so that you can see both files.
String downloadFileName = fileName.replace(".txt", "DOWNLOAD.txt");
File downloadedFile = new File(localPath + downloadFileName);

System.out.println("\nDownloading blob to\n\t " + localPath + downloadFileName);

blobClient.downloadToFile(localPath + downloadFileName);
Related