BlobURL class
A BlobURL represents a URL to an Azure Storage blob; the blob may be a block blob, append blob, or page blob.
- Extends
Constructors
BlobURL(string, Pipeline) | Creates an instance of BlobURL. This method accepts an encoded URL or non-encoded URL pointing to a blob. Encoded URL string will NOT be escaped twice, only special characters in URL path will be escaped. If a blob name includes ? or %, blob name must be encoded in the URL. |
Inherited Properties
credential | Credential used for authentication and authorization. |
url | Encoded URL string value. |
Methods
abort |
Aborts a pending asynchronous Copy Blob operation, and leaves a destination blob with zero length and full metadata. Version 2012-02-12 and newer. See https://docs.microsoft.com/en-us/rest/api/storageservices/abort-copy-blob |
acquire |
Establishes and manages a lock on a blob for write and delete operations. The lock duration can be 15 to 60 seconds, or can be infinite. In versions prior to 2012-02-12, the lock duration is 60 seconds. See https://docs.microsoft.com/en-us/rest/api/storageservices/lease-blob |
break |
To end the lease but ensure that another client cannot acquire a new lease until the current lease period has expired. See https://docs.microsoft.com/en-us/rest/api/storageservices/lease-blob |
change |
To change the ID of an existing lease. See https://docs.microsoft.com/en-us/rest/api/storageservices/lease-blob |
create |
Creates a read-only snapshot of a blob. See https://docs.microsoft.com/en-us/rest/api/storageservices/snapshot-blob |
delete(Aborter, IBlob |
Marks the specified blob or snapshot for deletion. The blob is later deleted during garbage collection. Note that in order to delete a blob, you must delete all of its snapshots. You can delete both at the same time with the Delete Blob operation. See https://docs.microsoft.com/en-us/rest/api/storageservices/delete-blob |
download(Aborter, number, number, IBlob |
Reads or downloads a blob from the system, including its metadata and properties. You can also call Get Blob to read a snapshot.
See https://docs.microsoft.com/en-us/rest/api/storageservices/get-blob |
from |
Creates a BlobURL object from an ContainerURL object. |
get |
Returns all user-defined metadata, standard HTTP properties, and system properties for the blob. It does not return the content of the blob. See https://docs.microsoft.com/en-us/rest/api/storageservices/get-blob-properties |
release |
To free the lease if it is no longer needed so that another client may immediately acquire a lease against the blob. See https://docs.microsoft.com/en-us/rest/api/storageservices/lease-blob |
renew |
To renew an existing lease. See https://docs.microsoft.com/en-us/rest/api/storageservices/lease-blob |
set |
Sets system properties on the blob. If no value provided, or no value provided for the specificed blob HTTP headers, these blob HTTP headers without a value will be cleared. See https://docs.microsoft.com/en-us/rest/api/storageservices/set-blob-properties |
set |
Sets user-defined metadata for the specified blob as one or more name-value pairs. If no option provided, or no metadata defined in the parameter, the blob metadata will be removed. See https://docs.microsoft.com/en-us/rest/api/storageservices/set-blob-metadata |
set |
Sets the tier on a blob. The operation is allowed on a page blob in a premium storage account and on a block blob in a blob storage account (locally redundant storage only). A premium page blob's tier determines the allowed size, IOPS, and bandwidth of the blob. A block blob's tier determines Hot/Cool/Archive storage type. This operation does not update the blob's ETag. See https://docs.microsoft.com/en-us/rest/api/storageservices/set-blob-tier |
start |
Asynchronously copies a blob to a destination within the storage account. In version 2012-02-12 and later, the source for a Copy Blob operation can be a committed blob in any Azure storage account. Beginning with version 2015-02-21, the source for a Copy Blob operation can be an Azure file in any Azure storage account. Only storage accounts created on or after June 7th, 2012 allow the Copy Blob operation to copy from another storage account. See https://docs.microsoft.com/en-us/rest/api/storageservices/copy-blob |
sync |
The synchronous Copy From URL operation copies a blob or an internet resource to a new blob. It will not return a response until the copy is complete. See https://docs.microsoft.com/en-us/rest/api/storageservices/copy-blob-from-url |
undelete(Aborter) | Restores the contents and metadata of soft deleted blob and any associated soft deleted snapshots. Undelete Blob is supported only on version 2017-07-29 or later. See https://docs.microsoft.com/en-us/rest/api/storageservices/undelete-blob |
with |
Creates a new BlobURL object identical to the source but with the specified request policy pipeline. |
with |
Creates a new BlobURL object identical to the source but with the specified snapshot timestamp. Provide "" will remove the snapshot and return a URL to the base blob. |
Inherited Methods
new |
A static method used to create a new Pipeline object with Credential provided. |
Constructor Details
BlobURL(string, Pipeline)
Creates an instance of BlobURL. This method accepts an encoded URL or non-encoded URL pointing to a blob. Encoded URL string will NOT be escaped twice, only special characters in URL path will be escaped. If a blob name includes ? or %, blob name must be encoded in the URL.
new BlobURL(url: string, pipeline: Pipeline)
Parameters
- url
-
string
A URL string pointing to Azure Storage blob, such as "https://myaccount.blob.core.windows.net/mycontainer/blob". You can append a SAS if using AnonymousCredential, such as "https://myaccount.blob.core.windows.net/mycontainer/blob?sasString". This method accepts an encoded URL or non-encoded URL pointing to a blob. Encoded URL string will NOT be escaped twice, only special characters in URL path will be escaped. However, if a blob name includes ? or %, blob name must be encoded in the URL. Such as a blob named "my?blob%", the URL should be "https://myaccount.blob.core.windows.net/mycontainer/my%3Fblob%25".
- pipeline
- Pipeline
Call StorageURL.newPipeline() to create a default pipeline, or provide a customized pipeline.
Inherited Property Details
credential
Credential used for authentication and authorization.
credential: Credential
Property Value
Inherited From StorageURL.credential
url
Method Details
abortCopyFromURL(Aborter, string, IBlobAbortCopyFromURLOptions)
Aborts a pending asynchronous Copy Blob operation, and leaves a destination blob with zero length and full metadata. Version 2012-02-12 and newer.
See https://docs.microsoft.com/en-us/rest/api/storageservices/abort-copy-blob
function abortCopyFromURL(aborter: Aborter, copyId: string, options?: IBlobAbortCopyFromURLOptions): Promise<BlobAbortCopyFromURLResponse>
Parameters
- aborter
- Aborter
Create a new Aborter instance with Aborter.none or Aborter.timeout(), goto documents of Aborter for more examples about request cancellation
- copyId
-
string
- options
- IBlobAbortCopyFromURLOptions
Returns
Promise<BlobAbortCopyFromURLResponse>
acquireLease(Aborter, string, number, IBlobAcquireLeaseOptions)
Establishes and manages a lock on a blob for write and delete operations. The lock duration can be 15 to 60 seconds, or can be infinite. In versions prior to 2012-02-12, the lock duration is 60 seconds.
See https://docs.microsoft.com/en-us/rest/api/storageservices/lease-blob
function acquireLease(aborter: Aborter, proposedLeaseId: string, duration: number, options?: IBlobAcquireLeaseOptions): Promise<BlobAcquireLeaseResponse>
Parameters
- aborter
- Aborter
Create a new Aborter instance with Aborter.none or Aborter.timeout(), goto documents of Aborter for more examples about request cancellation
- proposedLeaseId
-
string
Can be specified in any valid GUID string format
- duration
-
number
The lock duration can be 15 to 60 seconds, or can be infinite
- options
- IBlobAcquireLeaseOptions
Returns
Promise<BlobAcquireLeaseResponse>
breakLease(Aborter, number, IBlobBreakLeaseOptions)
To end the lease but ensure that another client cannot acquire a new lease until the current lease period has expired.
See https://docs.microsoft.com/en-us/rest/api/storageservices/lease-blob
function breakLease(aborter: Aborter, breakPeriod?: number, options?: IBlobBreakLeaseOptions): Promise<BlobBreakLeaseResponse>
Parameters
- aborter
- Aborter
Create a new Aborter instance with Aborter.none or Aborter.timeout(), goto documents of Aborter for more examples about request cancellation
- breakPeriod
-
number
- options
- IBlobBreakLeaseOptions
Returns
Promise<BlobBreakLeaseResponse>
changeLease(Aborter, string, string, IBlobChangeLeaseOptions)
To change the ID of an existing lease.
See https://docs.microsoft.com/en-us/rest/api/storageservices/lease-blob
function changeLease(aborter: Aborter, leaseId: string, proposedLeaseId: string, options?: IBlobChangeLeaseOptions): Promise<BlobChangeLeaseResponse>
Parameters
- aborter
- Aborter
Create a new Aborter instance with Aborter.none or Aborter.timeout(), goto documents of Aborter for more examples about request cancellation
- leaseId
-
string
- proposedLeaseId
-
string
- options
- IBlobChangeLeaseOptions
Returns
Promise<BlobChangeLeaseResponse>
createSnapshot(Aborter, IBlobCreateSnapshotOptions)
Creates a read-only snapshot of a blob.
See https://docs.microsoft.com/en-us/rest/api/storageservices/snapshot-blob
function createSnapshot(aborter: Aborter, options?: IBlobCreateSnapshotOptions): Promise<BlobCreateSnapshotResponse>
Parameters
- aborter
- Aborter
Create a new Aborter instance with Aborter.none or Aborter.timeout(), goto documents of Aborter for more examples about request cancellation
- options
- IBlobCreateSnapshotOptions
Returns
Promise<BlobCreateSnapshotResponse>
delete(Aborter, IBlobDeleteOptions)
Marks the specified blob or snapshot for deletion. The blob is later deleted during garbage collection. Note that in order to delete a blob, you must delete all of its snapshots. You can delete both at the same time with the Delete Blob operation.
See https://docs.microsoft.com/en-us/rest/api/storageservices/delete-blob
function delete(aborter: Aborter, options?: IBlobDeleteOptions): Promise<BlobDeleteResponse>
Parameters
- aborter
- Aborter
Create a new Aborter instance with Aborter.none or Aborter.timeout(), goto documents of Aborter for more examples about request cancellation
- options
- IBlobDeleteOptions
Returns
Promise<BlobDeleteResponse>
download(Aborter, number, number, IBlobDownloadOptions)
Reads or downloads a blob from the system, including its metadata and properties. You can also call Get Blob to read a snapshot.
- In Node.js, data returns in a Readable stream readableStreamBody
- In browsers, data returns in a promise blobBody
See https://docs.microsoft.com/en-us/rest/api/storageservices/get-blob
function download(aborter: Aborter, offset: number, count?: number, options?: IBlobDownloadOptions): Promise<BlobDownloadResponse>
Parameters
- aborter
- Aborter
Create a new Aborter instance with Aborter.none or Aborter.timeout(), goto documents of Aborter for more examples about request cancellation
- offset
-
number
From which position of the blob to download, >= 0
- count
-
number
How much data to be downloaded, > 0. Will download to the end when undefined
- options
- IBlobDownloadOptions
Returns
Promise<BlobDownloadResponse>
fromContainerURL(ContainerURL, string)
Creates a BlobURL object from an ContainerURL object.
static function fromContainerURL(containerURL: ContainerURL, blobName: string): BlobURL
Parameters
- containerURL
- ContainerURL
A ContainerURL object
- blobName
-
string
A blob name
Returns
getProperties(Aborter, IBlobGetPropertiesOptions)
Returns all user-defined metadata, standard HTTP properties, and system properties for the blob. It does not return the content of the blob.
See https://docs.microsoft.com/en-us/rest/api/storageservices/get-blob-properties
function getProperties(aborter: Aborter, options?: IBlobGetPropertiesOptions): Promise<BlobGetPropertiesResponse>
Parameters
- aborter
- Aborter
Create a new Aborter instance with Aborter.none or Aborter.timeout(), goto documents of Aborter for more examples about request cancellation
- options
- IBlobGetPropertiesOptions
Returns
Promise<BlobGetPropertiesResponse>
releaseLease(Aborter, string, IBlobReleaseLeaseOptions)
To free the lease if it is no longer needed so that another client may immediately acquire a lease against the blob.
See https://docs.microsoft.com/en-us/rest/api/storageservices/lease-blob
function releaseLease(aborter: Aborter, leaseId: string, options?: IBlobReleaseLeaseOptions): Promise<BlobReleaseLeaseResponse>
Parameters
- aborter
- Aborter
Create a new Aborter instance with Aborter.none or Aborter.timeout(), goto documents of Aborter for more examples about request cancellation
- leaseId
-
string
- options
- IBlobReleaseLeaseOptions
Returns
Promise<BlobReleaseLeaseResponse>
renewLease(Aborter, string, IBlobRenewLeaseOptions)
To renew an existing lease.
See https://docs.microsoft.com/en-us/rest/api/storageservices/lease-blob
function renewLease(aborter: Aborter, leaseId: string, options?: IBlobRenewLeaseOptions): Promise<BlobRenewLeaseResponse>
Parameters
- aborter
- Aborter
Create a new Aborter instance with Aborter.none or Aborter.timeout(), goto documents of Aborter for more examples about request cancellation
- leaseId
-
string
- options
- IBlobRenewLeaseOptions
Returns
Promise<BlobRenewLeaseResponse>
setHTTPHeaders(Aborter, BlobHTTPHeaders, IBlobSetHTTPHeadersOptions)
Sets system properties on the blob.
If no value provided, or no value provided for the specificed blob HTTP headers, these blob HTTP headers without a value will be cleared.
See https://docs.microsoft.com/en-us/rest/api/storageservices/set-blob-properties
function setHTTPHeaders(aborter: Aborter, blobHTTPHeaders?: BlobHTTPHeaders, options?: IBlobSetHTTPHeadersOptions): Promise<BlobSetHTTPHeadersResponse>
Parameters
- aborter
- Aborter
Create a new Aborter instance with Aborter.none or Aborter.timeout(), goto documents of Aborter for more examples about request cancellation
- blobHTTPHeaders
- BlobHTTPHeaders
If no value provided, or no value provided for the specificed blob HTTP headers, these blob HTTP headers without a value will be cleared.
- options
- IBlobSetHTTPHeadersOptions
Returns
Promise<BlobSetHTTPHeadersResponse>
setMetadata(Aborter, IMetadata, IBlobSetMetadataOptions)
Sets user-defined metadata for the specified blob as one or more name-value pairs.
If no option provided, or no metadata defined in the parameter, the blob metadata will be removed.
See https://docs.microsoft.com/en-us/rest/api/storageservices/set-blob-metadata
function setMetadata(aborter: Aborter, metadata?: IMetadata, options?: IBlobSetMetadataOptions): Promise<BlobSetMetadataResponse>
Parameters
- aborter
- Aborter
Create a new Aborter instance with Aborter.none or Aborter.timeout(), goto documents of Aborter for more examples about request cancellation
- metadata
-
IMetadata
Replace existing metadata with this value. If no value provided the existing metadata will be removed.
- options
- IBlobSetMetadataOptions
Returns
Promise<BlobSetMetadataResponse>
setTier(Aborter, string, IBlobSetTierOptions)
Sets the tier on a blob. The operation is allowed on a page blob in a premium storage account and on a block blob in a blob storage account (locally redundant storage only). A premium page blob's tier determines the allowed size, IOPS, and bandwidth of the blob. A block blob's tier determines Hot/Cool/Archive storage type. This operation does not update the blob's ETag.
See https://docs.microsoft.com/en-us/rest/api/storageservices/set-blob-tier
function setTier(aborter: Aborter, tier: string, options?: IBlobSetTierOptions): Promise<BlobSetTierResponse>
Parameters
- aborter
- Aborter
Create a new Aborter instance with Aborter.none or Aborter.timeout(), goto documents of Aborter for more examples about request cancellation
- tier
-
string
- options
- IBlobSetTierOptions
Returns
Promise<BlobSetTierResponse>
startCopyFromURL(Aborter, string, IBlobStartCopyFromURLOptions)
Asynchronously copies a blob to a destination within the storage account. In version 2012-02-12 and later, the source for a Copy Blob operation can be a committed blob in any Azure storage account. Beginning with version 2015-02-21, the source for a Copy Blob operation can be an Azure file in any Azure storage account. Only storage accounts created on or after June 7th, 2012 allow the Copy Blob operation to copy from another storage account.
See https://docs.microsoft.com/en-us/rest/api/storageservices/copy-blob
function startCopyFromURL(aborter: Aborter, copySource: string, options?: IBlobStartCopyFromURLOptions): Promise<BlobStartCopyFromURLResponse>
Parameters
- aborter
- Aborter
Create a new Aborter instance with Aborter.none or Aborter.timeout(), goto documents of Aborter for more examples about request cancellation
- copySource
-
string
- options
- IBlobStartCopyFromURLOptions
Returns
Promise<BlobStartCopyFromURLResponse>
syncCopyFromURL(Aborter, string, IBlobSyncCopyFromURLOptions)
The synchronous Copy From URL operation copies a blob or an internet resource to a new blob. It will not return a response until the copy is complete.
See https://docs.microsoft.com/en-us/rest/api/storageservices/copy-blob-from-url
function syncCopyFromURL(aborter: Aborter, copySource: string, options?: IBlobSyncCopyFromURLOptions): Promise<BlobCopyFromURLResponse>
Parameters
- aborter
- Aborter
Create a new Aborter instance with Aborter.none or Aborter.timeout(), goto documents of Aborter for more examples about request cancellation
- copySource
-
string
The source URL to copy from, Shared Access Signature(SAS) maybe needed for authentication
- options
- IBlobSyncCopyFromURLOptions
Returns
Promise<BlobCopyFromURLResponse>
undelete(Aborter)
Restores the contents and metadata of soft deleted blob and any associated soft deleted snapshots. Undelete Blob is supported only on version 2017-07-29 or later.
See https://docs.microsoft.com/en-us/rest/api/storageservices/undelete-blob
function undelete(aborter: Aborter): Promise<BlobUndeleteResponse>
Parameters
- aborter
- Aborter
Create a new Aborter instance with Aborter.none or Aborter.timeout(), goto documents of Aborter for more examples about request cancellation
Returns
Promise<BlobUndeleteResponse>
withPipeline(Pipeline)
Creates a new BlobURL object identical to the source but with the specified request policy pipeline.
function withPipeline(pipeline: Pipeline): BlobURL
Parameters
- pipeline
- Pipeline
Returns
withSnapshot(string)
Creates a new BlobURL object identical to the source but with the specified snapshot timestamp. Provide "" will remove the snapshot and return a URL to the base blob.
function withSnapshot(snapshot: string): BlobURL
Parameters
- snapshot
-
string
Returns
A new BlobURL object identical to the source but with the specified snapshot timestamp
Inherited Method Details
newPipeline(Credential, INewPipelineOptions)
A static method used to create a new Pipeline object with Credential provided.
static function newPipeline(credential: Credential, pipelineOptions?: INewPipelineOptions): Pipeline
Parameters
- credential
- Credential
Such as AnonymousCredential, SharedKeyCredential or TokenCredential.
- pipelineOptions
- INewPipelineOptions
Optional. Options.
Returns
A new Pipeline object.
Inherited From StorageURL.newPipeline
Azure SDK for JavaScript
Feedback
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for