Share via


@azure/storage-common package

Classes

AnonymousCredential

AnonymousCredential provides a credentialPolicyCreator member used to create AnonymousCredentialPolicy objects. AnonymousCredentialPolicy is used with HTTP(S) requests that read public resources or for use with Shared Access Signatures (SAS).

AnonymousCredentialPolicy

AnonymousCredentialPolicy is used with HTTP(S) requests that read public resources or for use with Shared Access Signatures (SAS).

BaseRequestPolicy

The base class from which all request policies derive.

BufferScheduler

This class accepts a Node.js Readable stream as input, and keeps reading data from the stream into the internal buffer structure, until it reaches maxBuffers. Every available buffer will try to trigger outgoingHandler.

The internal buffer structure includes an incoming buffer array, and a outgoing buffer array. The incoming buffer array includes the "empty" buffers can be filled with new incoming data. The outgoing array includes the filled buffers to be handled by outgoingHandler. Every above buffer size is defined by parameter bufferSize.

NUM_OF_ALL_BUFFERS = BUFFERS_IN_INCOMING + BUFFERS_IN_OUTGOING + BUFFERS_UNDER_HANDLING

NUM_OF_ALL_BUFFERS lesser than or equal to maxBuffers

PERFORMANCE IMPROVEMENT TIPS:

  1. Input stream highWaterMark is better to set a same value with bufferSize parameter, which will avoid Buffer.concat() operations.
  2. concurrency should set a smaller value than maxBuffers, which is helpful to reduce the possibility when a outgoing handler waits for the stream data. in this situation, outgoing handlers are blocked. Outgoing queue shouldn't be empty.
Credential

Credential is an abstract class for Azure Storage HTTP requests signing. This class will host an credentialPolicyCreator factory which generates CredentialPolicy.

CredentialPolicy

Credential policy used to sign HTTP(S) requests before sending. This is an abstract class.

StorageBrowserPolicy

StorageBrowserPolicy will handle differences between Node.js and browser runtime, including:

  1. Browsers cache GET/HEAD requests by adding conditional headers such as 'IF_MODIFIED_SINCE'. StorageBrowserPolicy is a policy used to add a timestamp query to GET/HEAD request URL thus avoid the browser cache.

  2. Remove cookie header for security

  3. Remove content-length header to avoid browsers warning

StorageBrowserPolicyFactory

StorageBrowserPolicyFactory is a factory class helping generating StorageBrowserPolicy objects.

StorageRetryPolicy

Retry policy with exponential retry and linear retry implemented.

StorageRetryPolicyFactory

StorageRetryPolicyFactory is a factory class helping generating StorageRetryPolicy objects.

StorageSharedKeyCredential

ONLY AVAILABLE IN NODE.JS RUNTIME.

StorageSharedKeyCredential for account key authorization of Azure Storage service.

StorageSharedKeyCredentialPolicy

StorageSharedKeyCredentialPolicy is a policy used to sign HTTP request with a shared key.

Interfaces

StorageRetryOptions

Storage Blob retry options interface.

StorageSharedKeyCredentialPolicyOptions

Options used to configure StorageSharedKeyCredentialPolicy.

Type Aliases

CredentialPolicyCreator

A factory function that creates a new CredentialPolicy that uses the provided nextPolicy.

OutgoingHandler

OutgoingHandler is an async function triggered by BufferScheduler.

Enums

StorageRetryPolicyType

RetryPolicy types.

Functions

NewRetryPolicyFactory(StorageRetryOptions)

A factory method used to generated a RetryPolicy factory.

getCachedDefaultHttpClient()
storageBrowserPolicy()

storageBrowserPolicy is a policy used to prevent browsers from caching requests and to remove cookies and explicit content-length headers.

storageCorrectContentLengthPolicy()

storageCorrectContentLengthPolicy to correctly set Content-Length header with request body length.

storageRetryPolicy(StorageRetryOptions)

Retry policy with exponential retry and linear retry implemented.

storageSharedKeyCredentialPolicy(StorageSharedKeyCredentialPolicyOptions)

storageSharedKeyCredentialPolicy handles signing requests using storage account keys.

Function Details

NewRetryPolicyFactory(StorageRetryOptions)

A factory method used to generated a RetryPolicy factory.

function NewRetryPolicyFactory(retryOptions?: StorageRetryOptions): RequestPolicyFactory

Parameters

retryOptions
StorageRetryOptions

Returns

getCachedDefaultHttpClient()

function getCachedDefaultHttpClient(): HttpClient

Returns

storageBrowserPolicy()

storageBrowserPolicy is a policy used to prevent browsers from caching requests and to remove cookies and explicit content-length headers.

function storageBrowserPolicy(): PipelinePolicy

Returns

storageCorrectContentLengthPolicy()

storageCorrectContentLengthPolicy to correctly set Content-Length header with request body length.

function storageCorrectContentLengthPolicy(): PipelinePolicy

Returns

storageRetryPolicy(StorageRetryOptions)

Retry policy with exponential retry and linear retry implemented.

function storageRetryPolicy(options?: StorageRetryOptions): PipelinePolicy

Parameters

Returns

storageSharedKeyCredentialPolicy(StorageSharedKeyCredentialPolicyOptions)

storageSharedKeyCredentialPolicy handles signing requests using storage account keys.

function storageSharedKeyCredentialPolicy(options: StorageSharedKeyCredentialPolicyOptions): PipelinePolicy

Parameters

Returns