Updated the sample of getUrl of BlobService and FileService

This commit is contained in:
Haibo Song 2016-08-12 17:52:59 +08:00
Родитель 46e0798677
Коммит b11c213211
2 изменённых файлов: 21 добавлений и 5 удалений

Просмотреть файл

@ -2241,9 +2241,16 @@ BlobService.prototype.generateSharedAccessSignature = function (container, blob,
* @example
* var azure = require('azure-storage');
* var blobService = azure.createBlobService();
* //create a SAS that expires in an hour
* var sasToken = blobService.generateSharedAccessSignature(containerName, blobName, { AccessPolicy: { Expiry: azure.date.minutesFromNow(60); } });
* var sasUrl = blobService.getUrl(containerName, blobName, sasToken, true);
* var sharedAccessPolicy = {
* AccessPolicy: {
* Permissions: azure.BlobUtilities.SharedAccessPermissions.READ,
* Start: startDate,
* Expiry: expiryDate
* },
* };
*
* var sasToken = blobService.generateSharedAccessSignature(containerName, blobName, sharedAccessPolicy);
* var sasUrl = blobService.getUrl(containerName, blobName, sasToken);
*/
BlobService.prototype.getUrl = function (container, blob, sasToken, primary, snapshotId) {
validate.validateArgs('getUrl', function (v) {

Просмотреть файл

@ -1589,8 +1589,17 @@ FileService.prototype.generateSharedAccessSignature = function (share, directory
* @return {string} The formatted URL string.
* @example
* var azure = require('azure-storage');
* var FileService = azure.createFileService();
* var url = FileService.getUrl(shareName, directoryName, fileName, sasToken, true);
* var fileService = azure.createFileService();
* var sharedAccessPolicy = {
* AccessPolicy: {
* Permissions: azure.FileUtilities.SharedAccessPermissions.READ,
* Start: startDate,
* Expiry: expiryDate
* },
* };
*
* var sasToken = fileService.generateSharedAccessSignature(shareName, directoryName, fileName, sharedAccessPolicy);
* var url = fileService.getUrl(shareName, directoryName, fileName, sasToken, true);
*/
FileService.prototype.getUrl = function (share, directory, file, sasToken, primary) {
validate.validateArgs('getUrl', function (v) {