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. |
Properties
credential | Credential used for authentication and authorization. |
pipeline | Request policy pipeline. |
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. |
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. |
break |
To end the lease but ensure that another client cannot acquire a new lease until the current lease period has expired. |
change |
To change the ID of an existing lease. |
create |
Creates a read-only snapshot of a 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. |
download(Aborter, number, undefined | 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.
|
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. |
new |
A static method used to create a new Pipeline object with Credential provided. |
release |
To free the lease if it is no longer needed so that another client may immediately acquire a lease against the blob. |
renew |
To renew an existing lease. |
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. |
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. |
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. |
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. |
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. |
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. |
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. |
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.
Property Details
credential
Credential used for authentication and authorization.
credential: Credential
Property Value
pipeline
url
Encoded URL string value.
url: string
Property Value
string
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.
function abortCopyFromURL(aborter: Aborter, copyId: string, options?: IBlobAbortCopyFromURLOptions)
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<Models.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.
function acquireLease(aborter: Aborter, proposedLeaseId: string, duration: number, options?: IBlobAcquireLeaseOptions)
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<Models.BlobAcquireLeaseResponse>
breakLease(Aborter, undefined | number, IBlobBreakLeaseOptions)
To end the lease but ensure that another client cannot acquire a new lease until the current lease period has expired.
function breakLease(aborter: Aborter, breakPeriod?: undefined | number, options?: IBlobBreakLeaseOptions)
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
-
undefined | number
- options
- IBlobBreakLeaseOptions
Returns
Promise<Models.BlobBreakLeaseResponse>
changeLease(Aborter, string, string, IBlobChangeLeaseOptions)
To change the ID of an existing lease.
function changeLease(aborter: Aborter, leaseId: string, proposedLeaseId: string, options?: IBlobChangeLeaseOptions)
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<Models.BlobChangeLeaseResponse>
createSnapshot(Aborter, IBlobCreateSnapshotOptions)
Creates a read-only snapshot of a blob.
function createSnapshot(aborter: Aborter, options?: IBlobCreateSnapshotOptions)
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<Models.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.
function delete(aborter: Aborter, options?: IBlobDeleteOptions)
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<Models.BlobDeleteResponse>
download(Aborter, number, undefined | 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
function download(aborter: Aborter, offset: number, count?: undefined | number, options?: IBlobDownloadOptions)
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
-
undefined | number
- options
- IBlobDownloadOptions
Returns
Promise<Models.BlobDownloadResponse>
fromContainerURL(ContainerURL, string)
Creates a BlobURL object from an ContainerURL object.
static function fromContainerURL(containerURL: ContainerURL, blobName: string)
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.
function getProperties(aborter: Aborter, options?: IBlobGetPropertiesOptions)
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<Models.BlobGetPropertiesResponse>
newPipeline(Credential, INewPipelineOptions)
A static method used to create a new Pipeline object with Credential provided.
static function newPipeline(credential: Credential, pipelineOptions?: INewPipelineOptions)
Parameters
- credential
- Credential
Such as AnonymousCredential, SharedKeyCredential or TokenCredential.
- pipelineOptions
- INewPipelineOptions
Returns
A new Pipeline object.
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.
function releaseLease(aborter: Aborter, leaseId: string, options?: IBlobReleaseLeaseOptions)
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<Models.BlobReleaseLeaseResponse>
renewLease(Aborter, string, IBlobRenewLeaseOptions)
To renew an existing lease.
function renewLease(aborter: Aborter, leaseId: string, options?: IBlobRenewLeaseOptions)
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<Models.BlobRenewLeaseResponse>
setHTTPHeaders(Aborter, Models.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.
function setHTTPHeaders(aborter: Aborter, blobHTTPHeaders?: Models.BlobHTTPHeaders, options?: IBlobSetHTTPHeadersOptions)
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
- Models.BlobHTTPHeaders
- options
- IBlobSetHTTPHeadersOptions
Returns
Promise<Models.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.
function setMetadata(aborter: Aborter, metadata?: IMetadata, options?: IBlobSetMetadataOptions)
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
- options
- IBlobSetMetadataOptions
Returns
Promise<Models.BlobSetMetadataResponse>
setTier(Aborter, BlockBlobTier | PremiumPageBlobTier | 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.
function setTier(aborter: Aborter, tier: BlockBlobTier | PremiumPageBlobTier | string, options?: IBlobSetTierOptions)
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
-
BlockBlobTier | PremiumPageBlobTier | string
- options
- IBlobSetTierOptions
Returns
Promise<Models.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.
function startCopyFromURL(aborter: Aborter, copySource: string, options?: IBlobStartCopyFromURLOptions)
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<Models.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.
function syncCopyFromURL(aborter: Aborter, copySource: string, options?: IBlobSyncCopyFromURLOptions)
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<Models.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.
function undelete(aborter: Aborter)
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<Models.BlobUndeleteResponse>
withPipeline(Pipeline)
Creates a new BlobURL object identical to the source but with the specified request policy pipeline.
function withPipeline(pipeline: Pipeline)
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)
Parameters
- snapshot
-
string
Returns
A new BlobURL object identical to the source but with the specified snapshot timestamp
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