BlobClient
in package
Provides operations for an Azure Storage blob.
Supports streaming downloads, automatic single-request or staged-block uploads, metadata and tag management, copy operations, leases, and SAS generation.
Table of Contents
Properties
- $blobName : string
- $containerName : string
- $credential : StorageSharedKeyCredential|TokenCredential|null
- $uri : UriInterface
- $blockBlobClient : BlockBlobClient
- $client : Client
- $options : BlobClientOptions
Methods
- __construct() : mixed
- abortCopyFromUri() : void
- Aborts a pending copy operation identified by its copy ID.
- abortCopyFromUriAsync() : PromiseInterface
- Asynchronously aborts a pending copy operation.
- canGenerateSasUri() : bool
- Returns whether this client has a shared-key credential capable of signing a blob SAS.
- delete() : void
- Deletes the blob.
- deleteAsync() : PromiseInterface
- Asynchronously deletes the blob.
- deleteIfExists() : void
- Deletes the blob if it exists.
- deleteIfExistsAsync() : PromiseInterface
- Asynchronously deletes the blob if it exists.
- downloadStreaming() : BlobDownloadStreamingResult
- Downloads the blob as a streaming response.
- downloadStreamingAsync() : PromiseInterface
- Asynchronously downloads the blob as a streaming response.
- exists() : bool
- Determines whether the blob exists.
- existsAsync() : PromiseInterface
- Asynchronously determines whether the blob exists.
- generateSasUri() : UriInterface
- Generates a URI for this blob containing a signed service SAS query string.
- getBlobLeaseClient() : BlobLeaseClient
- Creates a lease client for this blob without making a service request.
- getProperties() : BlobProperties
- Gets the blob's properties and metadata without downloading its content.
- getPropertiesAsync() : PromiseInterface
- Asynchronously gets the blob's properties and metadata.
- getTags() : array<string|int, string>
- Gets all index tags associated with the blob.
- getTagsAsync() : PromiseInterface
- Asynchronously gets all index tags associated with the blob.
- setHttpHeaders() : void
- Sets the blob's standard HTTP headers.
- setHttpHeadersAsync() : PromiseInterface
- Asynchronously sets the blob's standard HTTP headers.
- setMetadata() : void
- Replaces all user-defined metadata on the blob.
- setMetadataAsync() : PromiseInterface
- Asynchronously replaces all user-defined metadata on the blob.
- setTags() : void
- Replaces all index tags on the blob.
- setTagsAsync() : PromiseInterface
- Asynchronously replaces all index tags on the blob.
- startCopyFromUri() : BlobCopyResult
- Starts a potentially long-running server-side copy to this blob.
- startCopyFromUriAsync() : PromiseInterface
- Asynchronously starts a potentially long-running server-side copy.
- syncCopyFromUri() : BlobCopyResult
- Copies a source blob to this blob in a synchronous service operation.
- syncCopyFromUriAsync() : PromiseInterface
- Asynchronously performs a synchronous server-side copy to this blob.
- upload() : void
- Uploads content, staging blocks automatically when it exceeds the configured threshold.
- uploadAsync() : PromiseInterface
- Asynchronously uploads content, staging blocks automatically when required.
- waitForCopyCompletion() : BlobProperties
- Polls this blob until its current copy operation completes or the timeout expires.
- getNextBlockId() : string
- resolveMaximumTransferSize() : int
- uploadViaBlockBlobAsync() : PromiseInterface
- uploadViaPutBlobAsync() : PromiseInterface
Properties
$blobName read-only
public
string
$blobName
$containerName read-only
public
string
$containerName
$credential read-only
public
StorageSharedKeyCredential|TokenCredential|null
$credential
= null
$uri read-only
public
UriInterface
$uri
$blockBlobClient read-only
private
BlockBlobClient
$blockBlobClient
$client read-only
private
Client
$client
$options read-only
private
BlobClientOptions
$options
= new BlobClientOptions()
Methods
__construct()
public
__construct(UriInterface $uri[, StorageSharedKeyCredential|TokenCredential|null $credential = null ][, BlobClientOptions $options = new BlobClientOptions() ]) : mixed
Parameters
- $uri : UriInterface
-
URI of the blob, including any SAS query string.
- $credential : StorageSharedKeyCredential|TokenCredential|null = null
-
Credential used to authorize requests, or null for anonymous/SAS access.
- $options : BlobClientOptions = new BlobClientOptions()
-
Client transport and service-version options.
Tags
abortCopyFromUri()
Aborts a pending copy operation identified by its copy ID.
public
abortCopyFromUri(string $copyId[, AbortCopyFromUriOptions $options = new AbortCopyFromUriOptions() ]) : void
Parameters
- $copyId : string
- $options : AbortCopyFromUriOptions = new AbortCopyFromUriOptions()
abortCopyFromUriAsync()
Asynchronously aborts a pending copy operation.
public
abortCopyFromUriAsync(string $copyId[, AbortCopyFromUriOptions $options = new AbortCopyFromUriOptions() ]) : PromiseInterface
Parameters
- $copyId : string
- $options : AbortCopyFromUriOptions = new AbortCopyFromUriOptions()
Return values
PromiseInterfacecanGenerateSasUri()
Returns whether this client has a shared-key credential capable of signing a blob SAS.
public
canGenerateSasUri() : bool
Return values
booldelete()
Deletes the blob.
public
delete([DeleteBlobOptions $options = new DeleteBlobOptions() ]) : void
Parameters
- $options : DeleteBlobOptions = new DeleteBlobOptions()
deleteAsync()
Asynchronously deletes the blob.
public
deleteAsync([DeleteBlobOptions $options = new DeleteBlobOptions() ]) : PromiseInterface
Parameters
- $options : DeleteBlobOptions = new DeleteBlobOptions()
Return values
PromiseInterfacedeleteIfExists()
Deletes the blob if it exists.
public
deleteIfExists([DeleteBlobOptions $options = new DeleteBlobOptions() ]) : void
Parameters
- $options : DeleteBlobOptions = new DeleteBlobOptions()
deleteIfExistsAsync()
Asynchronously deletes the blob if it exists.
public
deleteIfExistsAsync([DeleteBlobOptions $options = new DeleteBlobOptions() ]) : PromiseInterface
Parameters
- $options : DeleteBlobOptions = new DeleteBlobOptions()
Return values
PromiseInterfacedownloadStreaming()
Downloads the blob as a streaming response.
public
downloadStreaming([DownloadBlobOptions $options = new DownloadBlobOptions() ]) : BlobDownloadStreamingResult
Parameters
- $options : DownloadBlobOptions = new DownloadBlobOptions()
Return values
BlobDownloadStreamingResultdownloadStreamingAsync()
Asynchronously downloads the blob as a streaming response.
public
downloadStreamingAsync([DownloadBlobOptions $options = new DownloadBlobOptions() ]) : PromiseInterface
Parameters
- $options : DownloadBlobOptions = new DownloadBlobOptions()
Return values
PromiseInterfaceexists()
Determines whether the blob exists.
public
exists() : bool
Return values
boolexistsAsync()
Asynchronously determines whether the blob exists.
public
existsAsync() : PromiseInterface
Return values
PromiseInterfacegenerateSasUri()
Generates a URI for this blob containing a signed service SAS query string.
public
generateSasUri(BlobSasBuilder $blobSasBuilder) : UriInterface
Parameters
- $blobSasBuilder : BlobSasBuilder
Tags
Return values
UriInterfacegetBlobLeaseClient()
Creates a lease client for this blob without making a service request.
public
getBlobLeaseClient([string|null $leaseId = null ]) : BlobLeaseClient
Parameters
- $leaseId : string|null = null
Return values
BlobLeaseClientgetProperties()
Gets the blob's properties and metadata without downloading its content.
public
getProperties([GetBlobPropertiesOptions $options = new GetBlobPropertiesOptions() ]) : BlobProperties
Parameters
- $options : GetBlobPropertiesOptions = new GetBlobPropertiesOptions()
Return values
BlobPropertiesgetPropertiesAsync()
Asynchronously gets the blob's properties and metadata.
public
getPropertiesAsync([GetBlobPropertiesOptions $options = new GetBlobPropertiesOptions() ]) : PromiseInterface
Parameters
- $options : GetBlobPropertiesOptions = new GetBlobPropertiesOptions()
Return values
PromiseInterfacegetTags()
Gets all index tags associated with the blob.
public
getTags([GetBlobTagsOptions $options = new GetBlobTagsOptions() ]) : array<string|int, string>
Parameters
- $options : GetBlobTagsOptions = new GetBlobTagsOptions()
Return values
array<string|int, string>getTagsAsync()
Asynchronously gets all index tags associated with the blob.
public
getTagsAsync([GetBlobTagsOptions $options = new GetBlobTagsOptions() ]) : PromiseInterface
Parameters
- $options : GetBlobTagsOptions = new GetBlobTagsOptions()
Return values
PromiseInterfacesetHttpHeaders()
Sets the blob's standard HTTP headers.
public
setHttpHeaders(BlobHttpHeaders $httpHeaders[, SetBlobHttpHeadersOptions $options = new SetBlobHttpHeadersOptions() ]) : void
Parameters
- $httpHeaders : BlobHttpHeaders
- $options : SetBlobHttpHeadersOptions = new SetBlobHttpHeadersOptions()
setHttpHeadersAsync()
Asynchronously sets the blob's standard HTTP headers.
public
setHttpHeadersAsync(BlobHttpHeaders $httpHeaders[, SetBlobHttpHeadersOptions $options = new SetBlobHttpHeadersOptions() ]) : PromiseInterface
Parameters
- $httpHeaders : BlobHttpHeaders
- $options : SetBlobHttpHeadersOptions = new SetBlobHttpHeadersOptions()
Return values
PromiseInterfacesetMetadata()
Replaces all user-defined metadata on the blob.
public
setMetadata(array<string|int, string> $metadata[, SetBlobMetadataOptions $options = new SetBlobMetadataOptions() ]) : void
Parameters
- $metadata : array<string|int, string>
- $options : SetBlobMetadataOptions = new SetBlobMetadataOptions()
setMetadataAsync()
Asynchronously replaces all user-defined metadata on the blob.
public
setMetadataAsync(array<string|int, string> $metadata[, SetBlobMetadataOptions $options = new SetBlobMetadataOptions() ]) : PromiseInterface
Parameters
- $metadata : array<string|int, string>
- $options : SetBlobMetadataOptions = new SetBlobMetadataOptions()
Return values
PromiseInterfacesetTags()
Replaces all index tags on the blob.
public
setTags(array<string|int, string> $tags[, SetBlobTagsOptions $options = new SetBlobTagsOptions() ]) : void
Parameters
- $tags : array<string|int, string>
- $options : SetBlobTagsOptions = new SetBlobTagsOptions()
setTagsAsync()
Asynchronously replaces all index tags on the blob.
public
setTagsAsync(array<string|int, string> $tags[, SetBlobTagsOptions $options = new SetBlobTagsOptions() ]) : PromiseInterface
Parameters
- $tags : array<string|int, string>
- $options : SetBlobTagsOptions = new SetBlobTagsOptions()
Return values
PromiseInterfacestartCopyFromUri()
Starts a potentially long-running server-side copy to this blob.
public
startCopyFromUri(UriInterface $source[, StartCopyFromUriOptions $options = new StartCopyFromUriOptions() ]) : BlobCopyResult
Parameters
- $source : UriInterface
- $options : StartCopyFromUriOptions = new StartCopyFromUriOptions()
Return values
BlobCopyResultstartCopyFromUriAsync()
Asynchronously starts a potentially long-running server-side copy.
public
startCopyFromUriAsync(UriInterface $source[, StartCopyFromUriOptions $options = new StartCopyFromUriOptions() ]) : PromiseInterface
Parameters
- $source : UriInterface
- $options : StartCopyFromUriOptions = new StartCopyFromUriOptions()
Return values
PromiseInterfacesyncCopyFromUri()
Copies a source blob to this blob in a synchronous service operation.
public
syncCopyFromUri(UriInterface $source[, SyncCopyFromUriOptions $options = new SyncCopyFromUriOptions() ]) : BlobCopyResult
Parameters
- $source : UriInterface
- $options : SyncCopyFromUriOptions = new SyncCopyFromUriOptions()
Return values
BlobCopyResultsyncCopyFromUriAsync()
Asynchronously performs a synchronous server-side copy to this blob.
public
syncCopyFromUriAsync(UriInterface $source[, SyncCopyFromUriOptions $options = new SyncCopyFromUriOptions() ]) : PromiseInterface
Parameters
- $source : UriInterface
- $options : SyncCopyFromUriOptions = new SyncCopyFromUriOptions()
Return values
PromiseInterfaceupload()
Uploads content, staging blocks automatically when it exceeds the configured threshold.
public
upload(string|resource|StreamInterface $content[, UploadBlobOptions $options = new UploadBlobOptions() ]) : void
Parameters
- $content : string|resource|StreamInterface
- $options : UploadBlobOptions = new UploadBlobOptions()
uploadAsync()
Asynchronously uploads content, staging blocks automatically when required.
public
uploadAsync(string|resource|StreamInterface $content[, UploadBlobOptions $options = new UploadBlobOptions() ]) : PromiseInterface
Parameters
- $content : string|resource|StreamInterface
- $options : UploadBlobOptions = new UploadBlobOptions()
Return values
PromiseInterfacewaitForCopyCompletion()
Polls this blob until its current copy operation completes or the timeout expires.
public
waitForCopyCompletion([int $pollingIntervalMs = 1000 ][, int|null $timeoutMs = null ]) : BlobProperties
Parameters
- $pollingIntervalMs : int = 1000
-
Delay between property requests in milliseconds.
- $timeoutMs : int|null = null
-
Maximum wait in milliseconds, or null for no timeout.
Return values
BlobPropertiesgetNextBlockId()
private
getNextBlockId(array<string|int, string> $blockIds) : string
Parameters
- $blockIds : array<string|int, string>
Return values
stringresolveMaximumTransferSize()
private
resolveMaximumTransferSize(StreamInterface $content, UploadBlobOptions $options) : int
Parameters
- $content : StreamInterface
- $options : UploadBlobOptions
Return values
intuploadViaBlockBlobAsync()
private
uploadViaBlockBlobAsync(StreamInterface $content, int $maximumConcurrency, int $maximumTransferSize, BlobHttpHeaders $httpHeaders, BlobRequestConditions|null $conditions) : PromiseInterface
Parameters
- $content : StreamInterface
- $maximumConcurrency : int
- $maximumTransferSize : int
- $httpHeaders : BlobHttpHeaders
- $conditions : BlobRequestConditions|null
Return values
PromiseInterfaceuploadViaPutBlobAsync()
private
uploadViaPutBlobAsync(StreamInterface $content, BlobHttpHeaders $httpHeaders, BlobRequestConditions|null $conditions) : PromiseInterface
Parameters
- $content : StreamInterface
- $httpHeaders : BlobHttpHeaders
- $conditions : BlobRequestConditions|null