@azure/storage-file package

Classes

Aborter

An aborter instance implements AbortSignal interface, can abort HTTP requests.

  • Call Aborter.none to create a new Aborter instance without timeout.
  • Call Aborter.timeout() to create a new Aborter instance with timeout.

For an existing instance aborter:

  • Call aborter.withTimeout() to create and return a child Aborter instance with timeout.
  • Call aborter.withValue(key, value) to create and return a child Aborter instance with key/value pair.
  • Call aborter.abort() to abort current instance and all children instances.
  • Call aborter.getValue(key) to search and get value with corresponding key from current aborter to all parents.

Example

// Abort without timeout
await fileURL.uploadRange(Aborter.none, buf, 0, buf.length);

Example

// Abort container create in 1000ms
await fileURL.uploadRange(Aborter.timeout(1000), buf, 0, buf.length);

Example

// Share aborter cross multiple operations in 30s
// Upload the same data to 2 different data centers at the same time, abort another when any of them is finished
const aborter = Aborter.timeout(30 * 1000);
fileURL1.uploadRange(aborter, buf, 0, buf.length).then(aborter.abort);
fileURL2.uploadRange(aborter, buf, 0, buf.length).then(aborter.abort);

Example

// Cascaded aborting
// All operations can't take more than 30 seconds
const aborter = Aborter.timeout(30 * 1000);

// Following 2 operations can't take more than 25 seconds
await fileURL.uploadRange(aborter.withTimeout(25 * 1000), buf, 0, buf.length);
await fileURL.uploadRange(aborter.withTimeout(25 * 1000), buf, 0, buf.length);
AccountSASPermissions

ONLY AVAILABLE IN NODE.JS RUNTIME.

This is a helper class to construct a string representing the permissions granted by an AccountSAS. Setting a value to true means that any SAS which uses these permissions will grant permissions for that operation. Once all the values are set, this should be serialized with toString and set as the permissions field on an IAccountSASSignatureValues object. It is possible to construct the permissions string without this class, but the order of the permissions is particular and this class guarantees correctness.

AccountSASResourceTypes

ONLY AVAILABLE IN NODE.JS RUNTIME.

This is a helper class to construct a string representing the resources accessible by an AccountSAS. Setting a value to true means that any SAS which uses these permissions will grant access to that resource type. Once all the values are set, this should be serialized with toString and set as the resources field on an IAccountSASSignatureValues object. It is possible to construct the resources string without this class, but the order of the resources is particular and this class guarantees correctness.

AccountSASServices

ONLY AVAILABLE IN NODE.JS RUNTIME.

This is a helper class to construct a string representing the services accessible by an AccountSAS. Setting a value to true means that any SAS which uses these permissions will grant access to that service. Once all the values are set, this should be serialized with toString and set as the services field on an IAccountSASSignatureValues object. It is possible to construct the services string without this class, but the order of the services is particular and this class guarantees correctness.

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
BrowserPolicyFactory

BrowserPolicyFactory is a factory class helping generating BrowserPolicy objects.

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.

DirectoryURL

A DirectoryURL represents a URL to the Azure Storage directory allowing you to manipulate its files and directories.

FileSASPermissions

ONLY AVAILABLE IN NODE.JS RUNTIME.

This is a helper class to construct a string representing the permissions granted by a ServiceSAS to a file. Setting a value to true means that any SAS which uses these permissions will grant permissions for that operation. Once all the values are set, this should be serialized with toString and set as the permissions field on a IFileSASSignatureValues object. It is possible to construct the permissions string without this class, but the order of the permissions is particular and this class guarantees correctness.

FileSystemAttributes

This is a helper class to construct a string representing the NTFS attributes to a file or directory.

See https://docs.microsoft.com/en-us/rest/api/storageservices/create-file#file-system-attributes

FileURL

A FileURL represents a URL to an Azure Storage file.

HttpHeaders

A collection of HTTP header key/value pairs.

LoggingPolicyFactory

LoggingPolicyFactory is a factory class helping generating LoggingPolicy objects.

Pipeline

A Pipeline class containing HTTP request policies. You can create a default Pipeline by calling StorageURL.newPipeline(). Or you can create a Pipeline with your own policies by the constructor of Pipeline. Refer to StorageURL.newPipeline() and provided policies as reference before implementing your customized Pipeline.

RequestPolicyOptions

Optional properties that can be used when creating a RequestPolicy.

RestError
RetryPolicyFactory

RetryPolicyFactory is a factory class helping generating RetryPolicy objects.

SASQueryParameters

Represents the components that make up an Azure Storage SAS' query parameters. This type is not constructed directly by the user; it is only generated by the IAccountSASSignatureValues and IFileSASSignatureValues types. Once generated, it can be encoded into a {@code String} and appended to a URL directly (though caution should be taken here in case there are existing query parameters, which might affect the appropriate means of appending these query parameters).

NOTE: Instances of this class are immutable.

ServiceURL

A ServiceURL represents a URL to the Azure Storage File service allowing you to manipulate file shares.

ShareSASPermissions

This is a helper class to construct a string representing the permissions granted by a ServiceSAS to a share. Setting a value to true means that any SAS which uses these permissions will grant permissions for that operation. Once all the values are set, this should be serialized with toString and set as the permissions field on a IFileSASSignatureValues object. It is possible to construct the permissions string without this class, but the order of the permissions is particular and this class guarantees correctness.

ShareURL

A ShareURL represents a URL to the Azure Storage share allowing you to manipulate its directories and files.

SharedKeyCredential

ONLY AVAILABLE IN NODE.JS RUNTIME.

SharedKeyCredential for account key authorization of Azure Storage service.

SharedKeyCredentialPolicy

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

StorageURL

A ServiceURL represents a based URL class for ServiceURL, ContainerURL and etc.

TelemetryPolicyFactory

TelemetryPolicyFactory is a factory class helping generating TelemetryPolicy objects.

UniqueRequestIDPolicyFactory

UniqueRequestIDPolicyFactory is a factory class helping generating UniqueRequestIDPolicy objects.

WebResource

Creates a new WebResource object.

This class provides an abstraction over a REST call by being library / implementation agnostic and wrapping the necessary properties to initiate a request.

Interfaces

AccessPolicy

An Access policy.

CorsRule

CORS is an HTTP feature that enables a web application running under one domain to access resources in another domain. Web browsers implement a security restriction known as same-origin policy that prevents a web page from calling APIs in a different domain; CORS provides a secure way to allow one domain (the origin domain) to call APIs in another domain.

DirectoryCreateHeaders

Defines headers for Create operation.

DirectoryCreateOptionalParams

Optional Parameters.

DirectoryDeleteHeaders

Defines headers for Delete operation.

DirectoryDeleteMethodOptionalParams

Optional Parameters.

DirectoryForceCloseHandlesHeaders

Defines headers for ForceCloseHandles operation.

DirectoryForceCloseHandlesOptionalParams

Optional Parameters.

DirectoryGetPropertiesHeaders

Defines headers for GetProperties operation.

DirectoryGetPropertiesOptionalParams

Optional Parameters.

DirectoryItem

A listed directory item.

DirectoryListFilesAndDirectoriesSegmentHeaders

Defines headers for ListFilesAndDirectoriesSegment operation.

DirectoryListFilesAndDirectoriesSegmentOptionalParams

Optional Parameters.

DirectoryListHandlesHeaders

Defines headers for ListHandles operation.

DirectoryListHandlesOptionalParams

Optional Parameters.

DirectorySetMetadataHeaders

Defines headers for SetMetadata operation.

DirectorySetMetadataOptionalParams

Optional Parameters.

DirectorySetPropertiesHeaders

Defines headers for SetProperties operation.

DirectorySetPropertiesOptionalParams

Optional Parameters.

FileAbortCopyHeaders

Defines headers for AbortCopy operation.

FileAbortCopyOptionalParams

Optional Parameters.

FileCreateHeaders

Defines headers for Create operation.

FileCreateOptionalParams

Optional Parameters.

FileDeleteHeaders

Defines headers for Delete operation.

FileDeleteMethodOptionalParams

Optional Parameters.

FileDownloadHeaders

Defines headers for Download operation.

FileDownloadOptionalParams

Optional Parameters.

FileForceCloseHandlesHeaders

Defines headers for ForceCloseHandles operation.

FileForceCloseHandlesOptionalParams

Optional Parameters.

FileGetPropertiesHeaders

Defines headers for GetProperties operation.

FileGetPropertiesOptionalParams

Optional Parameters.

FileGetRangeListHeaders

Defines headers for GetRangeList operation.

FileGetRangeListOptionalParams

Optional Parameters.

FileHTTPHeaders

Additional parameters for a set of operations, such as: File_create, File_setHTTPHeaders.

FileItem

A listed file item.

FileListHandlesHeaders

Defines headers for ListHandles operation.

FileListHandlesOptionalParams

Optional Parameters.

FileProperty

File properties.

FilesAndDirectoriesListSegment

Abstract for entries that can be listed from Directory.

FileSetHTTPHeadersHeaders

Defines headers for SetHTTPHeaders operation.

FileSetHTTPHeadersOptionalParams

Optional Parameters.

FileSetMetadataHeaders

Defines headers for SetMetadata operation.

FileSetMetadataOptionalParams

Optional Parameters.

FileStartCopyHeaders

Defines headers for StartCopy operation.

FileStartCopyOptionalParams

Optional Parameters.

FileUploadRangeFromURLHeaders

Defines headers for UploadRangeFromURL operation.

FileUploadRangeFromURLOptionalParams

Optional Parameters.

FileUploadRangeHeaders

Defines headers for UploadRange operation.

FileUploadRangeOptionalParams

Optional Parameters.

HandleItem

A listed Azure Storage handle item.

ListFilesAndDirectoriesSegmentResponse

An enumeration of directories and files.

ListHandlesResponse

An enumeration of handles.

ListSharesResponse

An enumeration of shares.

Metrics

Storage Analytics metrics for file service.

Permission

Permission(a security descriptor) described in the Security Descriptor Definition Language(SDDL).

Range

An Azure Storage file range.

RetentionPolicy

The retention policy.

ServiceGetPropertiesHeaders

Defines headers for GetProperties operation.

ServiceGetPropertiesOptionalParams

Optional Parameters.

ServiceListSharesSegmentHeaders

Defines headers for ListSharesSegment operation.

ServiceListSharesSegmentOptionalParams

Optional Parameters.

ServiceSetPropertiesHeaders

Defines headers for SetProperties operation.

ServiceSetPropertiesOptionalParams

Optional Parameters.

ShareCreateHeaders

Defines headers for Create operation.

ShareCreateOptionalParams

Optional Parameters.

ShareCreatePermissionHeaders

Defines headers for CreatePermission operation.

ShareCreatePermissionOptionalParams

Optional Parameters.

ShareCreateSnapshotHeaders

Defines headers for CreateSnapshot operation.

ShareCreateSnapshotOptionalParams

Optional Parameters.

ShareDeleteHeaders

Defines headers for Delete operation.

ShareDeleteMethodOptionalParams

Optional Parameters.

ShareGetAccessPolicyHeaders

Defines headers for GetAccessPolicy operation.

ShareGetAccessPolicyOptionalParams

Optional Parameters.

ShareGetPermissionHeaders

Defines headers for GetPermission operation.

ShareGetPermissionOptionalParams

Optional Parameters.

ShareGetPropertiesHeaders

Defines headers for GetProperties operation.

ShareGetPropertiesOptionalParams

Optional Parameters.

ShareGetStatisticsHeaders

Defines headers for GetStatistics operation.

ShareGetStatisticsOptionalParams

Optional Parameters.

ShareItem

A listed Azure Storage share item.

ShareProperties

Properties of a share.

ShareSetAccessPolicyHeaders

Defines headers for SetAccessPolicy operation.

ShareSetAccessPolicyOptionalParams

Optional Parameters.

ShareSetMetadataHeaders

Defines headers for SetMetadata operation.

ShareSetMetadataOptionalParams

Optional Parameters.

ShareSetQuotaHeaders

Defines headers for SetQuota operation.

ShareSetQuotaOptionalParams

Optional Parameters.

ShareStats

Stats for the share.

SignedIdentifier

Signed identifier.

SourceModifiedAccessConditions

Additional parameters for uploadRangeFromURL operation.

StorageError

An interface representing StorageError.

StorageServiceProperties

Storage service properties.

HttpOperationResponse

Wrapper object for http request and response. Deserialized object is stored in the parsedBody property when the response body is received in JSON or XML.

IAccountSASSignatureValues

ONLY AVAILABLE IN NODE.JS RUNTIME.

IAccountSASSignatureValues is used to generate a Shared Access Signature (SAS) for an Azure Storage account. Once all the values here are set appropriately, call generateSASQueryParameters() to obtain a representation of the SAS which can actually be applied to file urls. Note: that both this class and SASQueryParameters exist because the former is mutable and a logical representation while the latter is immutable and used to generate actual REST requests.

See https://docs.microsoft.com/en-us/azure/storage/common/storage-dotnet-shared-access-signature-part-1 for more conceptual information on SAS See https://docs.microsoft.com/en-us/rest/api/storageservices/constructing-an-account-sas for descriptions of the parameters, including which are required

IDirectoryCreateOptions
IDirectoryForceCloseHandlesSegmentOptions
IDirectoryListFilesAndDirectoriesSegmentOptions
IDirectoryListHandlesSegmentOptions
IDirectoryProperties
IDownloadFromAzureFileOptions

Option interface for DownloadAzurefileToBuffer.

IFileCreateOptions
IFileDownloadOptions
IFileGetRangeListOptions

The option is defined as parity to REST definition. While it's not ready to be used now, considering Crc64 of source content is not accessible.

IFileListHandlesSegmentOptions
IFileProperties
IFileSASSignatureValues

ONLY AVAILABLE IN NODE.JS RUNTIME.

IFileSASSignatureValues is used to help generating File service SAS tokens for shares or files.

IFileStartCopyOptions
IFileUploadRangeOptions
IHttpClient

An interface that can send HttpRequests and receive promised HttpResponses.

IHttpPipelineLogger

A Logger that can be added to a HttpPipeline. This enables each RequestPolicy to log messages that can be used for debugging purposes.

IIPRange

Allowed IP range for a SAS.

INewPipelineOptions

Option interface for Pipeline.newPipeline method.

IPipelineOptions

Option interface for Pipeline constructor.

IRange

Range for Service Operations.

See https://docs.microsoft.com/en-us/rest/api/storageservices/specifying-the-range-header-for-file-service-operations

IRequestLogOptions

RequestLogOptions configures the retry policy's behavior.

IRetryOptions

Retry options interface.

IServiceListSharesSegmentOptions
ISetPropertiesResponse

Contains response data for the setHTTPHeaders operation.

IShareCreateOptions
IShareCreateSnapshotOptions
IShareDeleteMethodOptions
ISignedIdentifier
ITelemetryOptions

Interface of TelemetryPolicy options.

IUploadStreamToAzureFileOptions

Option interface for uploadStreamToAzureFile.

IUploadToAzureFileOptions

Option interface for uploadFileToAzureFile and uploadSeekableStreamToAzureFile.

RequestPolicy

Type Aliases

CopyStatusType

Defines values for CopyStatusType. Possible values include: 'pending', 'success', 'aborted', 'failed'

DeleteSnapshotsOptionType

Defines values for DeleteSnapshotsOptionType. Possible values include: 'include'

DirectoryCreateResponse

Contains response data for the create operation.

DirectoryDeleteResponse

Contains response data for the deleteMethod operation.

DirectoryForceCloseHandlesResponse

Contains response data for the forceCloseHandles operation.

DirectoryGetPropertiesResponse

Contains response data for the getProperties operation.

DirectoryListFilesAndDirectoriesSegmentResponse

Contains response data for the listFilesAndDirectoriesSegment operation.

DirectoryListHandlesResponse

Contains response data for the listHandles operation.

DirectorySetMetadataResponse

Contains response data for the setMetadata operation.

DirectorySetPropertiesResponse

Contains response data for the setProperties operation.

FileAbortCopyResponse

Contains response data for the abortCopy operation.

FileCreateResponse

Contains response data for the create operation.

FileDeleteResponse

Contains response data for the deleteMethod operation.

FileDownloadResponse

Contains response data for the download operation.

FileForceCloseHandlesResponse

Contains response data for the forceCloseHandles operation.

FileGetPropertiesResponse

Contains response data for the getProperties operation.

FileGetRangeListResponse

Contains response data for the getRangeList operation.

FileListHandlesResponse

Contains response data for the listHandles operation.

FileRangeWriteType

Defines values for FileRangeWriteType. Possible values include: 'update', 'clear'

FileSetHTTPHeadersResponse

Contains response data for the setHTTPHeaders operation.

FileSetMetadataResponse

Contains response data for the setMetadata operation.

FileStartCopyResponse

Contains response data for the startCopy operation.

FileType

Defines values for FileType. Possible values include: 'File'

FileUploadRangeFromURLResponse

Contains response data for the uploadRangeFromURL operation.

FileUploadRangeResponse

Contains response data for the uploadRange operation.

ListSharesIncludeType

Defines values for ListSharesIncludeType. Possible values include: 'snapshots', 'metadata'

ServiceGetPropertiesResponse

Contains response data for the getProperties operation.

ServiceListSharesSegmentResponse

Contains response data for the listSharesSegment operation.

ServiceSetPropertiesResponse

Contains response data for the setProperties operation.

ShareCreatePermissionResponse

Contains response data for the createPermission operation.

ShareCreateResponse

Contains response data for the create operation.

ShareCreateSnapshotResponse

Contains response data for the createSnapshot operation.

ShareDeleteResponse

Contains response data for the deleteMethod operation.

ShareGetAccessPolicyResponse

Contains response data for the getAccessPolicy operation.

ShareGetPermissionResponse

Contains response data for the getPermission operation.

ShareGetPropertiesResponse

Contains response data for the getProperties operation.

ShareGetStatisticsResponse

Contains response data for the getStatistics operation.

ShareSetAccessPolicyResponse

Contains response data for the setAccessPolicy operation.

ShareSetMetadataResponse

Contains response data for the setMetadata operation.

ShareSetQuotaResponse

Contains response data for the setQuota operation.

StorageErrorCode

Defines values for StorageErrorCode. Possible values include: 'AccountAlreadyExists', 'AccountBeingCreated', 'AccountIsDisabled', 'AuthenticationFailed', 'AuthorizationFailure', 'ConditionHeadersNotSupported', 'ConditionNotMet', 'EmptyMetadataKey', 'InsufficientAccountPermissions', 'InternalError', 'InvalidAuthenticationInfo', 'InvalidHeaderValue', 'InvalidHttpVerb', 'InvalidInput', 'InvalidMd5', 'InvalidMetadata', 'InvalidQueryParameterValue', 'InvalidRange', 'InvalidResourceName', 'InvalidUri', 'InvalidXmlDocument', 'InvalidXmlNodeValue', 'Md5Mismatch', 'MetadataTooLarge', 'MissingContentLengthHeader', 'MissingRequiredQueryParameter', 'MissingRequiredHeader', 'MissingRequiredXmlNode', 'MultipleConditionHeadersNotSupported', 'OperationTimedOut', 'OutOfRangeInput', 'OutOfRangeQueryParameterValue', 'RequestBodyTooLarge', 'ResourceTypeMismatch', 'RequestUrlFailedToParse', 'ResourceAlreadyExists', 'ResourceNotFound', 'ServerBusy', 'UnsupportedHeader', 'UnsupportedXmlNode', 'UnsupportedQueryParameter', 'UnsupportedHttpVerb', 'CannotDeleteFileOrDirectory', 'ClientCacheFlushDelay', 'DeletePending', 'DirectoryNotEmpty', 'FileLockConflict', 'InvalidFileOrDirectoryPathName', 'ParentNotFound', 'ReadOnlyAttribute', 'ShareAlreadyExists', 'ShareBeingDeleted', 'ShareDisabled', 'ShareNotFound', 'SharingViolation', 'ShareSnapshotInProgress', 'ShareSnapshotCountExceeded', 'ShareSnapshotOperationNotSupported', 'ShareHasSnapshots', 'ContainerQuotaDowngradeNotAllowed'

CredentialPolicyCreator

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

FileAttributesPreserveType

Indicates keep existing file attributes unchanged.

FileGetRangeListResponse

Contains response data for the getRangeList operation.

FilePermissionInheritType

Indicates inherit file permission from the parent directory.

FilePermissionPreserveType

Indicates keep existing file permission value unchanged.

HttpRequestBody
RequestPolicyFactory

Creates a new RequestPolicy per-request that uses the provided nextPolicy.

ShareGetAccessPolicyResponse
ShareGetStatisticsResponse
TimeNowType

Indicates setting as the time of the request.

TimePreserveType

Indicates keep existing time value unchanged.

Enums

HttpPipelineLogLevel

The different levels of logs that can be used with the HttpPipelineLogger.

RetryPolicyType

RetryPolicy types.

SASProtocol

Protocols for generated SAS.

Functions

deserializationPolicy(DeserializationContentTypes)

Create a new serialization RequestPolicyCreator that will serialized HTTP request bodies as they pass through the HTTP pipeline.

downloadAzureFileToBuffer(Aborter, Buffer, FileURL, number, number, IDownloadFromAzureFileOptions)

ONLY AVAILABLE IN NODE.JS RUNTIME.

Downloads an Azure file in parallel to a buffer. Offset and count are optional, pass 0 for both to download the entire file.

generateAccountSASQueryParameters(IAccountSASSignatureValues, SharedKeyCredential)

ONLY AVAILABLE IN NODE.JS RUNTIME.

Generates a SASQueryParameters object which contains all SAS query parameters needed to make an actual REST request.

See https://docs.microsoft.com/en-us/rest/api/storageservices/constructing-an-account-sas

generateFileSASQueryParameters(IFileSASSignatureValues, SharedKeyCredential)

ONLY AVAILABLE IN NODE.JS RUNTIME.

Creates an instance of SASQueryParameters.

Only accepts required settings needed to create a SAS. For optional settings please set corresponding properties directly, such as permissions, startTime and identifier.

WARNING: When identifier is not provided, permissions and expiryTime are required. You MUST assign value to identifier or expiryTime & permissions manually if you initial with this constructor.

uploadBrowserDataToAzureFile(Aborter, Blob | ArrayBuffer | ArrayBufferView, FileURL, IUploadToAzureFileOptions)

ONLY AVAILABLE IN BROWSERS.

Uploads a browser Blob/File/ArrayBuffer/ArrayBufferView object to an Azure File.

uploadFileToAzureFile(Aborter, string, FileURL, IUploadToAzureFileOptions)

ONLY AVAILABLE IN NODE.JS RUNTIME.

Uploads a local file to an Azure file.

uploadStreamToAzureFile(Aborter, Readable, number, FileURL, number, number, IUploadStreamToAzureFileOptions)

ONLY AVAILABLE IN NODE.JS RUNTIME.

Uploads a Node.js Readable stream into an Azure file. This method will try to create an Azure, then starts uploading chunk by chunk. Size of chunk is defined by bufferSize parameter. Please make sure potential size of stream doesn't exceed file size.

PERFORMANCE IMPROVEMENT TIPS:

  • Input stream highWaterMark is better to set a same value with bufferSize parameter, which will avoid Buffer.concat() operations.

Function Details

deserializationPolicy(DeserializationContentTypes)

Create a new serialization RequestPolicyCreator that will serialized HTTP request bodies as they pass through the HTTP pipeline.

function deserializationPolicy(deserializationContentTypes?: DeserializationContentTypes): RequestPolicyFactory

Parameters

deserializationContentTypes
DeserializationContentTypes

Returns

downloadAzureFileToBuffer(Aborter, Buffer, FileURL, number, number, IDownloadFromAzureFileOptions)

ONLY AVAILABLE IN NODE.JS RUNTIME.

Downloads an Azure file in parallel to a buffer. Offset and count are optional, pass 0 for both to download the entire file.

function downloadAzureFileToBuffer(aborter: Aborter, buffer: Buffer, fileURL: FileURL, offset: number, count?: number, options?: IDownloadFromAzureFileOptions): Promise<void>

Parameters

aborter
Aborter

Create a new Aborter instance with Aborter.none or Aborter.timeout(), goto documents of Aborter for more examples about request cancellation

buffer

Buffer

Buffer to be fill, must have length larger than count

fileURL
FileURL

A FileURL object

offset

number

From which position of the Azure File to download

count

number

How much data to be downloaded. Will download to the end when passing undefined

Returns

Promise<void>

generateAccountSASQueryParameters(IAccountSASSignatureValues, SharedKeyCredential)

ONLY AVAILABLE IN NODE.JS RUNTIME.

Generates a SASQueryParameters object which contains all SAS query parameters needed to make an actual REST request.

See https://docs.microsoft.com/en-us/rest/api/storageservices/constructing-an-account-sas

function generateAccountSASQueryParameters(accountSASSignatureValues: IAccountSASSignatureValues, sharedKeyCredential: SharedKeyCredential): SASQueryParameters

Parameters

accountSASSignatureValues
IAccountSASSignatureValues
sharedKeyCredential
SharedKeyCredential

Returns

generateFileSASQueryParameters(IFileSASSignatureValues, SharedKeyCredential)

ONLY AVAILABLE IN NODE.JS RUNTIME.

Creates an instance of SASQueryParameters.

Only accepts required settings needed to create a SAS. For optional settings please set corresponding properties directly, such as permissions, startTime and identifier.

WARNING: When identifier is not provided, permissions and expiryTime are required. You MUST assign value to identifier or expiryTime & permissions manually if you initial with this constructor.

function generateFileSASQueryParameters(fileSASSignatureValues: IFileSASSignatureValues, sharedKeyCredential: SharedKeyCredential): SASQueryParameters

Parameters

fileSASSignatureValues
IFileSASSignatureValues
sharedKeyCredential
SharedKeyCredential

Returns

uploadBrowserDataToAzureFile(Aborter, Blob | ArrayBuffer | ArrayBufferView, FileURL, IUploadToAzureFileOptions)

ONLY AVAILABLE IN BROWSERS.

Uploads a browser Blob/File/ArrayBuffer/ArrayBufferView object to an Azure File.

function uploadBrowserDataToAzureFile(aborter: Aborter, browserData: Blob | ArrayBuffer | ArrayBufferView, fileURL: FileURL, options?: IUploadToAzureFileOptions): Promise<void>

Parameters

aborter
Aborter

Create a new Aborter instance with Aborter.none or Aborter.timeout(), goto documents of Aborter for more examples about request cancellation

browserData

Blob | ArrayBuffer | ArrayBufferView

Blob, File, ArrayBuffer or ArrayBufferView

fileURL
FileURL

Returns

Promise<void>

uploadFileToAzureFile(Aborter, string, FileURL, IUploadToAzureFileOptions)

ONLY AVAILABLE IN NODE.JS RUNTIME.

Uploads a local file to an Azure file.

function uploadFileToAzureFile(aborter: Aborter, filePath: string, fileURL: FileURL, options?: IUploadToAzureFileOptions): Promise<void>

Parameters

aborter
Aborter

Create a new Aborter instance with Aborter.none or Aborter.timeout(), goto documents of Aborter for more examples about request cancellation

filePath

string

Full path of local file

fileURL
FileURL

FileURL

Returns

Promise<void>

uploadStreamToAzureFile(Aborter, Readable, number, FileURL, number, number, IUploadStreamToAzureFileOptions)

ONLY AVAILABLE IN NODE.JS RUNTIME.

Uploads a Node.js Readable stream into an Azure file. This method will try to create an Azure, then starts uploading chunk by chunk. Size of chunk is defined by bufferSize parameter. Please make sure potential size of stream doesn't exceed file size.

PERFORMANCE IMPROVEMENT TIPS:

  • Input stream highWaterMark is better to set a same value with bufferSize parameter, which will avoid Buffer.concat() operations.
function uploadStreamToAzureFile(aborter: Aborter, stream: Readable, size: number, fileURL: FileURL, bufferSize: number, maxBuffers: number, options?: IUploadStreamToAzureFileOptions): Promise<void>

Parameters

aborter
Aborter

Create a new Aborter instance with Aborter.none or Aborter.timeout(), goto documents of Aborter for more examples about request cancellation

stream

Readable

Node.js Readable stream. Must be less or equal than file size.

size

number

Size of file to be created. Maxium size allowed is 1TB. If this value is larger than stream size, there will be empty bytes in file tail.

fileURL
FileURL

A FileURL instance

bufferSize

number

Size of every buffer allocated in bytes, also the chunk/range size during the uploaded file. Size must be > 0 and <= 4 * 1024 * 1024 (4MB)

maxBuffers

number

Max buffers will allocate during uploading, positive correlation with max uploading concurrency

Returns

Promise<void>