簡體   English   中英

無法使用Node.js SDK下載文件夾內的Blob

[英]Can't download blobs inside a folder using Node.js SDK

我正在嘗試在azure的blob容器中下載一些blob。

當文件放在根容器中時,我成功了,但是當它在文件夾中時,我沒有成功。

const folder = 'AZURE_FOLDER';

const filesToDownload =  [ 'icon.ico', 'images/cover.jpg', 'images/htmlstructure.png' ]

filesToDownload.forEach(blob => {
      service.download(containerName, blob, `${folder}/${blob}`)
});

運行此代碼,下載的文件為“ icon.ico”,但所有其他我收到此錯誤:

錯誤:{錯誤:ENOENT:沒有這樣的文件或目錄,請打開'AZURE_FOLDER / images / cover.jpg'

錯誤:{錯誤:ENOENT:沒有這樣的文件或目錄,請打開'AZURE_FOLDER / images / htmlstructure.png'

我的listBlobs回應:

BlobResult {
  name: 'images/cover.jpg',
  creationTime: 'Wed, 03 Apr 2019 17:14:03 GMT',
  lastModified: 'Wed, 03 Apr 2019 17:14:03 GMT',
  etag: '0x8D6B857C5B2B355',
  contentLength: '299040',
  contentSettings: 
   { contentType: 'image/jpeg',
     contentEncoding: '',
     contentLanguage: '',
     contentMD5: 'JqJRnPltEsAhar+YfKgEtQ==',
     cacheControl: '',
     contentDisposition: '' },
  blobType: 'BlockBlob',
  accessTier: 'Hot',
  accessTierInferred: true,
  lease: { status: 'unlocked', state: 'available' },
  serverEncrypted: 'true' }
BlobResult {
  name: 'images/htmlstructure.png',
  creationTime: 'Wed, 03 Apr 2019 17:14:02 GMT',
  lastModified: 'Wed, 03 Apr 2019 17:14:02 GMT',
  etag: '0x8D6B857C4ECA732',
  contentLength: '65835',
  contentSettings: 
   { contentType: 'image/png',
     contentEncoding: '',
     contentLanguage: '',
     contentMD5: 'uHsFKqK9csssX0XYt86dlA==',
     cacheControl: '',
     contentDisposition: '' },
  blobType: 'BlockBlob',
  accessTier: 'Hot',
  accessTierInferred: true,
  lease: { status: 'unlocked', state: 'available' },
  serverEncrypted: 'true' }
BlobResult {
  name: 'user.ico',
  creationTime: 'Wed, 03 Apr 2019 16:58:24 GMT',
  lastModified: 'Wed, 03 Apr 2019 16:58:33 GMT',
  etag: '0x8D6B8559B5CC9C8',
  contentLength: '179677',
  contentSettings: 
   { contentType: 'image/x-icon',
     contentEncoding: '',
     contentLanguage: '',
     contentMD5: 'sHZ3nvd9fyX09EkqQvDvLQ==',
     cacheControl: '',
     contentDisposition: '' },
  blobType: 'BlockBlob',
  accessTier: 'Hot',
  accessTierInferred: true,
  lease: { status: 'unlocked', state: 'available' },
  serverEncrypted: 'true' }

AZURE_FOLDER/images目錄是否存在? 如果不是,則需要預先使用fs模塊創建它。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM