StorageStreamDownloader class

Definition

A streaming object to download from Azure Storage.

StorageStreamDownloader(clients=None, config=None, start_range=None, end_range=None, validate_content=None, encryption_options=None, max_concurrency=1, name=None, container=None, encoding=None, **kwargs)
Inheritance
builtins.object
StorageStreamDownloader

Variables

name
str
The name of the blob being downloaded.
container
str
The name of the container where the blob is.
properties
BlobProperties
The properties of the blob being downloaded. If only a range of the data is being downloaded, this will be reflected in the properties.
size
int
The size of the total data in the stream. This will be the byte range if speficied, otherwise the total size of the blob.

Methods

chunks
content_as_bytes

Download the contents of this file.

This operation is blocking until all data is downloaded.

content_as_text

Download the contents of this blob, and decode as text.

This operation is blocking until all data is downloaded.

download_to_stream

Download the contents of this blob to a stream.

readall

Download the contents of this blob.

This operation is blocking until all data is downloaded. :rtype: bytes or str

readinto

Download the contents of this file to a stream.

chunks

chunks()

content_as_bytes

Download the contents of this file.

This operation is blocking until all data is downloaded.

content_as_bytes(max_concurrency=1)

Parameters

max_concurrency
default value: 1

Return type

bytes

content_as_text

Download the contents of this blob, and decode as text.

This operation is blocking until all data is downloaded.

content_as_text(max_concurrency=1, encoding='UTF-8')

Parameters

encoding
str
default value: 1

Test encoding to decode the downloaded bytes. Default is UTF-8.

encoding
default value: UTF-8

Return type

str

download_to_stream

Download the contents of this blob to a stream.

download_to_stream(stream, max_concurrency=1)

Parameters

stream
Required

The stream to download to. This can be an open file-handle, or any writable stream. The stream must be seekable if the download uses more than one parallel connection.

max_concurrency
default value: 1

Returns

The properties of the downloaded blob.

Return type

Any

readall

Download the contents of this blob.

This operation is blocking until all data is downloaded. :rtype: bytes or str

readall()

readinto

Download the contents of this file to a stream.

readinto(stream)

Parameters

stream
Required

The stream to download to. This can be an open file-handle, or any writable stream. The stream must be seekable if the download uses more than one parallel connection.

Returns

The number of bytes read.

Return type

int