DAK
DAK

Reputation: 372

Azure Blob Container file download

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?

Upvotes: 2

Views: 2119

Answers (1)

Sajeetharan
Sajeetharan

Reputation: 222582

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

Upvotes: 1

Related Questions