如何从node.js创建Azure AppendBlob

时间:2018-03-14 14:41:48

标签: javascript node.js azure azure-storage

我已经安装了npm azure-storage 包。

在Azure上,我创建了一个存储帐户和一个容器。

然后我尝试创建一个Append Blob:

const azure = require('azure-storage');
const service = azure.createBlobService("[ACCOUNT]", "[KEY]");
service.createAppendBlobFromText("[CONTAINER]",
                                 "some-blob-name", 
                                 "some-text", 
                                 {},
                                (err, result) => {
   console.log('err ->',err);
   console.log('result ->',result);
});

调用它的结果是:

err -> { Error
    at Function.StorageServiceClient._normalizeError (/[REMOVED]/node_modules/azure-storage/lib/common/services/storageserviceclient.js:1191:23)
    at BlobService.StorageServiceClient._processResponse (/[REMOVED]/node_modules/azure-storage/lib/common/services/storageserviceclient.js:738:50)
    at Request.processResponseCallback [as _callback] (/[REMOVED]/node_modules/azure-storage/lib/common/services/storageserviceclient.js:311:37)
    at Request.self.callback (/[REMOVED]/node_modules/request/request.js:186:22)
    at emitTwo (events.js:125:13)
    at Request.emit (events.js:213:7)
    at Request.<anonymous> (/[REMOVED]/node_modules/request/request.js:1163:10)
    at emitOne (events.js:115:13)
    at Request.emit (events.js:210:7)
    at IncomingMessage.<anonymous> (/[REMOVED]/node_modules/request/request.js:1085:12)
    at Object.onceWrapper (events.js:314:30)
    at emitNone (events.js:110:20)
    at IncomingMessage.emit (events.js:207:7)
    at endReadableNT (_stream_readable.js:1045:12)
    at _combinedTickCallback (internal/process/next_tick.js:138:11)
    at process._tickCallback (internal/process/next_tick.js:180:9)
  name: 'StorageError',
  message: 'Append blobs are not supported.\nRequestId:ed1777f4-601c-00cf-19a0-bb77ba000000\nTime:2018-03-14T14:25:50.8138962Z',
  code: 'BlobTypeNotSupported',
  statusCode: 400,
  requestId: 'ed1777f4-601c-00cf-19a0-bb77ba000000' }
result -> null

在搜索错误时,我找不到任何东西。

我在这里错过了什么吗?

1 个答案:

答案 0 :(得分:0)

请检查您尝试创建此Blob的存储帐户的冗余类型。

Blob类型支持因存储帐户冗余类型而异。

例如,ZRS Classic冗余类型的存储帐户仅支持Block Blob,而Premium LRS冗余类型的存储帐户仅支持Page Blob