Methods
-
createBlobService(storageAccountOrConnectionString [, storageAccessKey] [, host])
-
Creates a new BlobService object.
If no storageaccount or storageaccesskey are provided, the AZURE_STORAGE_CONNECTION_STRING and then the AZURE_STORAGE_ACCOUNT and AZURE_STORAGE_ACCESS_KEY
environment variables will be used.Parameters:
Name Type Argument Description storageAccountOrConnectionString
string The storage account or the connection string.
storageAccessKey
string <optional>
The storage access key.
host
string | object <optional>
The host address. To define primary only, pass a string.
Otherwise 'host.primaryHost' defines the primary host and 'host.secondaryHost' defines the secondary host.- Source:
Returns:
A new BlobService object.
- Type
- BlobService
-
createBlobServiceAnonymous(host)
-
Creates a new BlobService object using the host uri and anonymous access.
Parameters:
Name Type Description host
string | object The host address. To define primary only, pass a string.
Otherwise 'host.primaryHost' defines the primary host and 'host.secondaryHost' defines the secondary host.- Source:
Returns:
A new BlobService object with the anonymous credentials.
- Type
- BlobService
-
createBlobServiceWithSas(host, sasToken)
-
Creates a new BlobService object using the host Uri and the SAS credentials provided.
Parameters:
Name Type Description host
string | object The host address. To define primary only, pass a string.
Otherwise 'host.primaryHost' defines the primary host and 'host.secondaryHost' defines the secondary host.sasToken
string The Shared Access Signature token.
- Source:
Returns:
A new BlobService object with the SAS credentials.
- Type
- BlobService
-
createBlobServiceWithTokenCredential(host, tokenCredential)
-
Creates a new BlobService object using the host Uri and the TokenCredential provided, which supports OAuth.
Parameters:
Name Type Description host
string | object The host address. To define primary only, pass a string.
Otherwise 'host.primaryHost' defines the primary host and 'host.secondaryHost' defines the secondary host.tokenCredential
TokenCredential The token credential object.
- Source:
Returns:
A new BlobService object with the TokenCredential object.
- Type
- BlobService
Example
var azure = require('azure-storage'); var tokenCredential = new azure.TokenCredential('myOAuthAccessToken'); var blobService = azure.createBlobServiceWithTokenCredential('https://account.blob.core.windows.net', tokenCredential); tokenCredential.set('updatedOAuthAccessToken');
-
createFileService(storageAccountOrConnectionString [, storageAccessKey] [, host])
-
Creates a new FileService object.
If no storageaccount or storageaccesskey are provided, the AZURE_STORAGE_CONNECTION_STRING and then the AZURE_STORAGE_ACCOUNT and AZURE_STORAGE_ACCESS_KEY
environment variables will be used.Parameters:
Name Type Argument Description storageAccountOrConnectionString
string The storage account or the connection string.
storageAccessKey
string <optional>
The storage access key.
host
string | object <optional>
The host address. To define primary only, pass a string.
Otherwise 'host.primaryHost' defines the primary host and 'host.secondaryHost' defines the secondary host.- Source:
Returns:
A new FileService object.
- Type
- FileService
-
createFileServiceWithSas(host, sasToken)
-
Creates a new FileService object using the host Uri and the SAS credentials provided.
Parameters:
Name Type Description host
string | object The host address. To define primary only, pass a string.
Otherwise 'host.primaryHost' defines the primary host and 'host.secondaryHost' defines the secondary host.sasToken
string The Shared Access Signature token.
- Source:
Returns:
A new FileService object with the SAS credentials.
- Type
- FileService
-
createQueueService( [storageAccountOrConnectionString] [, storageAccessKey] [, host])
-
Creates a new QueueService object.
If no storageaccount or storageaccesskey are provided, the AZURE_STORAGE_CONNECTION_STRING and then the AZURE_STORAGE_ACCOUNT and AZURE_STORAGE_ACCESS_KEY
environment variables will be used.Parameters:
Name Type Argument Description storageAccountOrConnectionString
string <optional>
The storage account or the connection string.
storageAccessKey
string <optional>
The storage access key.
host
string | object <optional>
The host address. To define primary only, pass a string.
Otherwise 'host.primaryHost' defines the primary host and 'host.secondaryHost' defines the secondary host.- Source:
Returns:
A new QueueService object.
- Type
- QueueService
-
createQueueServiceWithSas(host, sasToken)
-
Creates a new QueueService object using the host Uri and the SAS credentials provided.
Parameters:
Name Type Description host
string | object The host address. To define primary only, pass a string.
Otherwise 'host.primaryHost' defines the primary host and 'host.secondaryHost' defines the secondary host.sasToken
string The Shared Access Signature token.
- Source:
Returns:
A new QueueService object with the SAS credentials.
- Type
- QueueService
-
createQueueServiceWithTokenCredential(host, tokenCredential)
-
Creates a new QueueService object using the host Uri and the TokenCredential provided, which supports OAuth.
Parameters:
Name Type Description host
string | object The host address. To define primary only, pass a string.
Otherwise 'host.primaryHost' defines the primary host and 'host.secondaryHost' defines the secondary host.tokenCredential
TokenCredential The TokenCredential object.
- Source:
Returns:
A new QueueService object with the TokenCredential object.
- Type
- QueueService
Example
var azure = require('azure-storage'); var tokenCredential = new azure.TokenCredential('myOAuthAccessToken'); var queueService = azure.createQueueServiceWithTokenCredential('https://account.queue.core.windows.net', tokenCredential); tokenCredential.set('updatedOAuthAccessToken');
-
createTableService( [storageAccountOrConnectionString] [, storageAccessKey] [, host])
-
Creates a new TableService object.
If no storageaccount or storageaccesskey are provided, the AZURE_STORAGE_CONNECTION_STRING and then the AZURE_STORAGE_ACCOUNT and AZURE_STORAGE_ACCESS_KEY
environment variables will be used.Parameters:
Name Type Argument Description storageAccountOrConnectionString
string <optional>
The storage account or the connection string.
storageAccessKey
string <optional>
The storage access key.
host
string | object <optional>
The host address. To define primary only, pass a string.
Otherwise 'host.primaryHost' defines the primary host and 'host.secondaryHost' defines the secondary host.- Source:
Returns:
A new TableService object.
- Type
- TableService
-
createTableServiceWithSas(host, sasToken)
-
Creates a new TableService object using the host Uri and the SAS credentials provided.
Parameters:
Name Type Description host
string | object The host address. To define primary only, pass a string.
Otherwise 'host.primaryHost' defines the primary host and 'host.secondaryHost' defines the secondary host.sasToken
string The Shared Access Signature token.
- Source:
Returns:
A new TableService object with the SAS credentials.
- Type
- TableService
-
generateAccountSharedAccessSignature( [storageAccountOrConnectionString] [, storageAccessKey], sharedAccessPolicy)
-
Generates an account shared access signature token
Parameters:
Name Type Argument Description storageAccountOrConnectionString
string <optional>
The storage account or the connection string.
storageAccessKey
string <optional>
The storage access key.
sharedAccessPolicy
object The shared access policy.
Properties
Name Type Description AccessPolicy.Services
SharedAccessServices The services (blob, file, queue, table) for a shared access signature associated with this shared access policy.
Refer toConstants.AccountSasConstants.Services
.AccessPolicy.ResourceTypes
SharedAccessResourceTypes The resource type for a shared access signature associated with this shared access policy.
Refer toConstants.AccountSasConstants.ResourceTypes
.AccessPolicy.Permissions
SharedAccessPermissions The permissions for a shared access signature.
Refer toConstants.AccountSasConstants.Permissions
.AccessPolicy.Start
date The time at which the Shared Access Signature becomes valid.
AccessPolicy.Expiry
date The time at which the Shared Access Signature becomes expired.
AccessPolicy.IPAddressOrRange
string The permission type. Refer to
Constants.AccountSasConstants.ResourceTypes
.AccessPolicy.Protocols
string The possible protocols. Refer to
Constants.AccountSasConstants.ResourceTypes
.- Source:
-
generateDevelopmentStorageCredentials( [proxyUri])
-
Creates a connection string that can be used to create a service which runs on the storage emulator. The emulator must be downloaded separately.
Parameters:
Name Type Argument Description proxyUri
string <optional>
The proxyUri. By default, http://127.0.0.1
- Source:
Returns:
A connection string representing the development storage credentials.
- Type
- string
Example
var azure = require('azure-storage'); var devStoreCreds = azure.generateDevelopmentStorageCredentials(); var blobService = azure.createBlobService(devStoreCreds);
Type Definitions
-
AccessConditions
-
Specifying conditional headers for blob service operations. See http://msdn.microsoft.com/en-us/library/dd179371.aspx for more information.
Type:
- object
- Source:
Properties:
Name Type Description EtagMatch
string If the ETag for the blob matches the specified ETag.
Specify the wildcard character (*) to perform the operation only if the resource does exist, and fail the operation if it does not exist.EtagNonMatch
string If the ETag for the blob does not match the specified ETag.
Specify the wildcard character (*) to perform the operation only if the resource does not exist, and fail the operation if it does exist.DateModifedSince
Date | string If the blob has been modified since the specified date.
DateUnModifiedSince
Date | string If the blob has not been modified since the specified date.
SequenceNumberLessThanOrEqual
Number | string If the blob's sequence number is less than or equal to the specified value.
For Put Page operation only. See https://msdn.microsoft.com/en-us/library/azure/ee691975.aspx for more information.SequenceNumberLessThan
Number | string If the blob's sequence number is less than the specified value.
For Put Page operation only. See https://msdn.microsoft.com/en-us/library/azure/ee691975.aspx for more information.SequenceNumberEqual
Number | string If the blob's sequence number is equal to the specified value.
For Put Page operation only. See https://msdn.microsoft.com/en-us/library/azure/ee691975.aspx for more information.MaxBlobSize
Number | string If the Append Block operation would cause the blob to exceed that limit or if the blob size is already greater than the specified value.
For Append Block operation only. See https://msdn.microsoft.com/en-us/library/mt427365.aspx for more information.MaxAppendPosition
Number | string If the append position is equal to the specified value.
For Append Block operation only. See https://msdn.microsoft.com/en-us/library/mt427365.aspx for more information. -
AccessPolicy
-
The access policy.
Type:
- object
- Source:
Properties:
Name Type Description Permissions
string The permission type.
Start
Date The time at which the access policy becomes valid.
Expiry
Date The time at which the access policy becomes expired.
IPAddressOrRange
string An IP address or a range of IP addresses from which to accept requests. When specifying a range, note that the range is inclusive.
Protocols
string The protocols permitted for a request made with the SAS.
Services
string The services (blob, file, queue, table) for a shared access signature associated with this shared access policy.
ResourceTypes
string The resource type for a shared access signature associated with this shared access policy.
-
AccountProperties
-
The properties of a storage account.
Type:
- object
- Source:
Properties:
Name Type Description SkuName
string The header that specifies storage SKU, also known as account type.
AccountKind
string The header that describes the flavour of the storage account, also known as account kind.
-
BlobServiceProperties
-
The properties of a blob storage service, including properties of Storage Analytics, CORS (Cross-Origin Resource Sharing) rules and Static Webiste configurations.
Type:
- object
- Source:
Properties:
Name Type Description DefaultServiceVersion
string The default version of Storage Analytics currently in use.
Logging
LoggingProperties The Logging settings.
HourMetrics
MetricsProperties The HourMetrics settings provide a summary of request statistics grouped by API in hourly aggregates.
MinuteMetrics
MetricsProperties The HourMetrics settings provide request statistics grouped by API for each minute.
StaticWebsite
StaticWebsiteProperties The Azure Static Website settings.
Cors
object Groups all CORS rules.
Properties
Name Type Description CorsRules
Array.<CorsRule> Groups settings for a
CORS rule
. -
ContainerAclResult
-
The container ACL settings.
Type:
- object
- Source:
Properties:
Name Type Description signedIdentifiers
Object.<string, AccessPolicy> The container ACL settings. See
AccessPolicy
for detailed information. -
CorsRule
-
The CORS rule of a storage service.
Type:
- object
- Source:
Properties:
Name Type Description AllowedMethods
Array.<string> A list of HTTP methods that are allowed to be executed by the origin. For Azure Storage, permitted methods are DELETE, GET, HEAD, MERGE, POST, OPTIONS or PUT.
AllowedOrigins
Array.<string> A list of origin domains that are allowed via CORS, or "*" if all domains are allowed.
AllowedHeaders
Array.<string> A list of headers allowed to be part of the cross-origin request.
ExposedHeaders
Array.<string> A list of response headers to expose to CORS clients.
MaxAgeInSeconds
number The number of seconds that the client/browser should cache a preflight response.
-
errorOrResponse(error, response)
-
A callback that returns a response object.
Parameters:
Name Type Description error
object If an error occurs, will contain information about the error.
response
object Contains information about the response returned for the operation.
For example, HTTP status codes and headers.- Source:
-
errorOrResult(error, result, response)
-
A callback that returns result and response objects.
Parameters:
Name Type Description error
object If an error occurs, will contain information about the error.
result
object The result of the operation.
response
object Contains information about the response returned for the operation.
For example, HTTP status codes and headers.- Source:
-
LoggingProperties
-
The Azure Analytics logging settings.
Type:
- object
- Source:
Properties:
Name Type Description Version
string The version of Storage Analytics currently in use for logging.
Delete
boolean Indicates whether delete requests are being logged.
Read
boolean Indicates whether read requests are being logged.
Write
boolean Indicates whether write requests are being logged.
RetentionPolicy
RetentionPolicy The retention policy of the log data.
-
MetricsProperties
-
The setting of Azure Analytics summary of request stastics.
Type:
- object
- Source:
Properties:
Name Type Description Version
string The version of Storage Analytics currently in use for hour metrics.
Enabled
string Indicates whether metrics are enabled
IncludeAPIs
boolean Indicates whether metrics generate summary statistics for called API operations.
RetentionPolicy
RetentionPolicy The retention policy of the metrics data.
-
Range
-
The range.
Type:
- object
- Source:
Properties:
Name Type Description start
number The start of the range.
end
number The end of the range.
-
RangeDiff
-
The range diff. Refer to https://msdn.microsoft.com/en-us/library/azure/mt736912.aspx
Type:
- object
- Source:
Properties:
Name Type Description start
number The start of the range.
end
number The end of the range.
isCleared
boolean If the range is cleared or not.
-
RetentionPolicy
-
The Azure Analytics logging or metrics retention policy.
Type:
- object
- Source:
Properties:
Name Type Description Enabled
boolean Indicates whether a retention policy is enabled for the storage service.
Days
number Indicates the number of days that logging data is retained. All data older than this value will be deleted.
-
ServiceProperties
-
The properties of a storage service, including properties of Storage Analytics and CORS (Cross-Origin Resource Sharing) rules.
Type:
- object
- Source:
Properties:
Name Type Description DefaultServiceVersion
string The default version of Storage Analytics currently in use.
Logging
LoggingProperties The Logging settings.
HourMetrics
MetricsProperties The HourMetrics settings provide a summary of request statistics grouped by API in hourly aggregates.
MinuteMetrics
MetricsProperties The HourMetrics settings provide request statistics grouped by API for each minute.
Cors
object Groups all CORS rules.
Properties
Name Type Description CorsRules
Array.<CorsRule> Groups settings for a
CORS rule
. -
ServiceStats
-
The service statistics.
Type:
- object
- Source:
Properties:
Name Type Description GeoReplication
object The geo replication stastics.
Properties
Name Type Description Status
string The status of the secondary location.
LastSyncTime
Date A GMT date/time value, to the second.
All primary writes preceding this value are guaranteed to be available for read operations at the secondary.
Primary writes after this point in time may or may not be available for reads. -
The share ACL settings.
Type:
- object
- Source:
Properties:
Name Type Description signedIdentifiers
Object.<string, AccessPolicy> The container ACL settings. See
AccessPolicy
for detailed information. -
StaticWebsiteProperties
-
The Azure Static Website settings.
Type:
- object
- Source:
Properties:
Name Type Description Enabled
boolean Whether feature of Static Website is enabled.
IndexDocument
string Indicates index document page path.
ErrorDocument404Path
string Indicates 404 document page path.