javascript - 无法使用 Node.js SDK 下载文件夹内的 blob
问题描述
我正在尝试在天蓝色的 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
事先使用该模块创建它。
推荐阅读
- ios - How would I create the visual equivalent of a UIView in SwiftUI?
- java - 添加 NavigationItemSelectedListener 后菜单项不会变为活动状态
- html - `innerHTML` 不适用于 `input` 标签,但 `value` 可以
- java - Spring JPA 中的方法名称太长
- c# - 使用定时器和任务的 Arduino 到 C# 实时数据传输
- java - @RequestBody 应该用 Spring Webflux 中的 Mono Publisher 包装吗?
- r - 定义一个新变量来计算另一列的组元素
- typescript - 为什么 TypeScript 中的 instanceof 不适用于继承的类?
- ios - 反应本机 - 在 ios 中未调用关闭事件时的 Web 套接字
- c - 为什么我的 PSET1 Credit 可以在沙盒中工作,但不能在 Check50 中工作?