Azure存储Javascript SDK V12创建附加Blob问题

时间:2020-02-06 14:12:56

标签: azure-storage-blobs azure-node-sdk

当我在门户中手动创建blob并尝试以下操作时:

const blockBlobClient = containerClient.getAppendBlobClient('appendtest.csv');
const uploadBlobResponse = await blockBlobClient.appendBlock('test,','test,'.length);

像魅力一样工作。

但是如果我尝试:

const blockBlobClient = containerClient.uploadBlockBlob('appendtest2.csv','test,','test,'.length, {"x-ms-blob-type":"AppendBlob"});
const uploadBlobResponse = await blockBlobClient.appendBlock('test,','test,'.length);

我收到错误消息,表明blob不是受支持的类型。

1 个答案:

答案 0 :(得分:0)

在仔细研究了Type定义后,解决了这个问题:

const blockBlobClient = await containerClient.getAppendBlobClient('appendtest5.csv');
const createresponse = await blockBlobClient.create();
const uploadBlobResponse = await blockBlobClient.appendBlock('test,','test,'.length);