[英]How can I get the blob URL after a file upload to Azure from node.js
I uploaded a file to my blob storage in Azure and now I want to get the Azure link for the upload.我将文件上传到 Azure 中的 Blob 存储,现在我想获取用于上传的 Azure 链接。 I'm using node.js and below is my code:
我正在使用 node.js,下面是我的代码:
blobService.createContainerIfNotExists('trimfaces', {
publicAccessLevel: 'blob'
}, function(error, result, response) {
if (!error) {
// if result = true, container was created.
// if result = false, container already existed.
}
});
You might want to call blobService.getUrl(containerName, blobName)
.您可能想要调用
blobService.getUrl(containerName, blobName)
。 The API document is here: http://azure.github.io/azure-storage-node/BlobService.html#getUrl API 文档在这里: http : //azure.github.io/azure-storage-node/BlobService.html#getUrl
[Updated] [更新]
The versioned document for v10 or later is at: https://azuresdkdocs.blob.core.windows.net/$web/javascript/azure-storage-blob/12.0.0/classes/blockblobclient.html#url v10 或更高版本的版本文档位于: https : //azuresdkdocs.blob.core.windows.net/$web/javascript/azure-storage-blob/12.0.0/classes/blockblobclient.html#url
According to the documentation, this is the way to list blobs using node:根据文档,这是使用节点列出 blob 的方法:
blobSvc.listBlobsSegmented('mycontainer', null, function(error, result, response){
if(!error){
// result.entries contains the entries
// If not all blobs were returned, result.continuationToken has the continuation token.
}
});
You can see the entire documentation for Azure Storage Blobs here: https://azure.microsoft.com/en-us/documentation/articles/storage-nodejs-how-to-use-blob-storage/您可以在此处查看 Azure 存储 Blob 的完整文档: https : //azure.microsoft.com/en-us/documentation/articles/storage-nodejs-how-to-use-blob-storage/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.