Skip to content

Commit

Permalink
Generate parent folder before downloading (#86)
Browse files Browse the repository at this point in the history
  • Loading branch information
zhou9584 authored Oct 25, 2022
1 parent 8a15a41 commit b9491e6
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,10 @@ public String uploadBlobFromFile(File uploadFile, String containerName, String b
* @return
*/
public BlobProperties downloadFileFromBlob(File downloadToFile, String containerName, String blobFilePath) {
File saveDir = downloadToFile.getParentFile();
if (!saveDir.exists()) {
cn.hutool.core.lang.Assert.isTrue(saveDir.mkdirs(), "mkdirs fail in downloadFileFromUrl");
}
BlobContainerClient blobContainerClient = blobServiceClient.getBlobContainerClient(containerName);
BlobClient blobClient = blobContainerClient.getBlobClient(blobFilePath);
return blobClient.downloadToFile(downloadToFile.getAbsolutePath(), true);
Expand Down

0 comments on commit b9491e6

Please sign in to comment.