b2sdk.download_dest
– Download destination¶
-
class
b2sdk.download_dest.
AbstractDownloadDestination
[source]¶ Bases:
object
Interface to a destination for a downloaded file.
-
abstract
make_file_context
(file_id, file_name, content_length, content_type, content_sha1, file_info, mod_time_millis, range_=None)[source]¶ Returns a context manager that yields a binary file-like object to use for writing the contents of the file.
- Parameters
file_id – the B2 file ID from the headers
file_name – the B2 file name from the headers
content_type – the content type from the headers
content_sha1 – the content sha1 from the headers (or “none” for large files)
file_info – the user file info from the headers
mod_time_millis – the desired file modification date in ms since 1970-01-01
range – starting and ending offsets of the received file contents. Usually None, which means that the whole file is downloaded.
- Returns
None
-
abstract
-
class
b2sdk.download_dest.
DownloadDestBytes
[source]¶ Bases:
b2sdk.download_dest.AbstractDownloadDestination
Stores a downloaded file into bytes in memory.
-
make_file_context
(file_id, file_name, content_length, content_type, content_sha1, file_info, mod_time_millis, range_=None)[source]¶ Returns a context manager that yields a binary file-like object to use for writing the contents of the file.
- Parameters
file_id – the B2 file ID from the headers
file_name – the B2 file name from the headers
content_type – the content type from the headers
content_sha1 – the content sha1 from the headers (or “none” for large files)
file_info – the user file info from the headers
mod_time_millis – the desired file modification date in ms since 1970-01-01
range – starting and ending offsets of the received file contents. Usually None, which means that the whole file is downloaded.
- Returns
None
-
-
class
b2sdk.download_dest.
DownloadDestLocalFile
(local_file_path)[source]¶ Bases:
b2sdk.download_dest.AbstractDownloadDestination
Stores a downloaded file into a local file and sets its modification time.
-
MODE
= 'wb+'¶
-
make_file_context
(file_id, file_name, content_length, content_type, content_sha1, file_info, mod_time_millis, range_=None)[source]¶ Returns a context manager that yields a binary file-like object to use for writing the contents of the file.
- Parameters
file_id – the B2 file ID from the headers
file_name – the B2 file name from the headers
content_type – the content type from the headers
content_sha1 – the content sha1 from the headers (or “none” for large files)
file_info – the user file info from the headers
mod_time_millis – the desired file modification date in ms since 1970-01-01
range – starting and ending offsets of the received file contents. Usually None, which means that the whole file is downloaded.
- Returns
None
-
-
class
b2sdk.download_dest.
DownloadDestProgressWrapper
(download_dest, progress_listener)[source]¶ Bases:
b2sdk.download_dest.AbstractDownloadDestination
Wraps a DownloadDestination, and reports progress to a ProgressListener.
-
__init__
(download_dest, progress_listener)[source]¶ Initialize self. See help(type(self)) for accurate signature.
-
make_file_context
(file_id, file_name, content_length, content_type, content_sha1, file_info, mod_time_millis, range_=None)[source]¶ Returns a context manager that yields a binary file-like object to use for writing the contents of the file.
- Parameters
file_id – the B2 file ID from the headers
file_name – the B2 file name from the headers
content_type – the content type from the headers
content_sha1 – the content sha1 from the headers (or “none” for large files)
file_info – the user file info from the headers
mod_time_millis – the desired file modification date in ms since 1970-01-01
range – starting and ending offsets of the received file contents. Usually None, which means that the whole file is downloaded.
- Returns
None
-
-
class
b2sdk.download_dest.
PreSeekedDownloadDest
(local_file_path, seek_target)[source]¶ Bases:
b2sdk.download_dest.DownloadDestLocalFile
Stores a downloaded file into a local file and sets its modification time. Does not truncate the target file, seeks to a given offset just after opening a descriptor.
-
MODE
= 'rb+'¶
-