第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問(wèn)題,去搜搜看,總會(huì)有你想問(wèn)的

從 Azure Blob 存儲(chǔ)下載 blob 列表

從 Azure Blob 存儲(chǔ)下載 blob 列表

牛魔王的故事 2023-06-04 11:09:51
我創(chuàng)建了CloudBlobContainer正確的連接字符串:@Bean@SneakyThrowspublic CloudBlobContainer blobContainer(CloudStorageAccount cloudStorageAccount) {    return cloudStorageAccount            .createCloudBlobClient()            .getContainerReference(containerName);}我看到使用的 blob 列表blobContainer.listBlobs()目前,我正在尋找從特定文件夾下載列表 blob 的最有效方法。
查看完整描述

3 回答

?
慕桂英4014372

TA貢獻(xiàn)1871條經(jīng)驗(yàn) 獲得超13個(gè)贊

listBlobs()方法有一個(gè)overload接受prefix參數(shù)。

public?Iterable<ListBlobItem>?listBlobs(final?String?prefix,?final?boolean?useFlatBlobListing)?{
????????return?this.listBlobs(prefix,?useFlatBlobListing,?EnumSet.noneOf(BlobListingDetails.class),?null,?null);
????}

您需要傳遞path of the folderasprefix和傳遞truefor?useFlatBlobListing,這將列出該虛擬文件夾中的所有 blob。

獲得該 blob 列表后,您可以使用downloadToFile每個(gè) blob 上的方法下載 blob。



查看完整回答
反對(duì) 回復(fù) 2023-06-04
?
楊__羊羊

TA貢獻(xiàn)1943條經(jīng)驗(yàn) 獲得超7個(gè)贊

一段時(shí)間后,我發(fā)現(xiàn)我可以應(yīng)用CloudBlockBlob類(lèi)型ListBlobItem和下載方法。


@Bean

@SneakyThrows

public CommandLineRunner commandLineRunner(CloudBlobContainer blobContainer) {

    return args -> {

        Sets.newConcurrentHashSet(blobContainer.listBlobs("documents/"))

                .stream()

                .filter(it -> it.getUri().toString().contains("pdf"))

                .forEach(it -> {

                    ((CloudBlockBlob) it).downloadToFile(((CloudBlockBlob) it).getName());

                });


    };

}


查看完整回答
反對(duì) 回復(fù) 2023-06-04
?
互換的青春

TA貢獻(xiàn)1797條經(jīng)驗(yàn) 獲得超6個(gè)贊

你可以通過(guò)兩種方式做到這一點(diǎn)


(i) AZcopy-AzCopy /Source:https://myaccount.file.core.windows.net/demo/ /Dest:C:\myfolder /SourceKey:key /S


(ii) 通過(guò)Azure Cli——


# Create a directory to store all the blobs

mkdir /downloaded-container && cd /downloaded-container


# Get all the blobs

BLOBS=$(az storage blob list -c $CONTAINER \

? ? --account-name $ACCOUNT_NAME --sas-token "$SAS_TOKEN" \

? ? --query [*].name --output tsv)


# Download each one

for BLOB in $BLOBS

do

? echo "********Downloading $BLOB"

? az storage blob download -n $BLOB -f $BLOB -c $CONTAINER --account-name $ACCOUNT_NAME --sas-token "$SAS_TOKEN"

done

如果您只想通過(guò)代碼,這里有一個(gè),sample repo因?yàn)闆](méi)有直接的方法可以通過(guò) SDK 完成。

HttpGet httpGet = new HttpGet(urlString);

? ? ? ? ? ? signRequest(httpGet, resourcePath, account, hashFunction);

? ? ? ? ? ? try (CloseableHttpResponse response = httpClient.execute(httpGet)) {

? ? ? ? ? ? ? ? System.out.println(response.getStatusLine());


查看完整回答
反對(duì) 回復(fù) 2023-06-04
  • 3 回答
  • 0 關(guān)注
  • 242 瀏覽
慕課專(zhuān)欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)