![](/img/trans.png)
[英]Stream a video from Azure-Storage by using node.js '@azure/storage-blob' package
[英]How to get secure url of File in blob storage via @azure/storage-blob in node.js?
我正在使用@azure/storage-blob,我可以上傳文件,但如何檢索它? 任何想法如何獲取存儲的 SAS url?
我需要生成幾分鍾后過期的 url,並且 url 是基於令牌的,因為容器不用於公共訪問。 請在 node.js 中提供幫助或指導我使用一些插件來幫助獲取/生成 blob 存儲中該文件的 sas url。 先感謝您!
要在 blob 上生成共享訪問簽名 (SAS URL),您可以使用 SDK 中提供的generateBlobSASQueryParameters
函數。
const blobSAS = generateBlobSASQueryParameters({
containerName, // Required
blobName, // Required
permissions: BlobSASPermissions.parse("r"), // Required
startsOn: new Date(), // Required
expiresOn: new Date(new Date().valueOf() + 86400) // Optional. Date type
},
sharedKeyCredential // StorageSharedKeyCredential - `new StorageSharedKeyCredential(account, accountKey)`
).toString();
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.