Download destination

Note

Concrete classes described in this chapter implement methods defined in AbstractDownloadDestination

class b2sdk.v1.AbstractDownloadDestination[source]

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]

Return a context manager that yields a binary file-like object to use for writing the contents of the file.

Parameters
  • file_id (str) – the B2 file ID from the headers

  • file_name (str) – the B2 file name from the headers

  • content_length (str) – the content length

  • content_type (str) – the content type from the headers

  • content_sha1 (str) – the content sha1 from the headers (or "none" for large files)

  • file_info (dict) – the user file info from the headers

  • mod_time_millis (int) – the desired file modification date in ms since 1970-01-01

  • range (None,tuple[int,int]) – starting and ending offsets of the received file contents. Usually None, which means that the whole file is downloaded.

Returns

None

class b2sdk.v1.DownloadDestLocalFile[source]

Store a downloaded file into a local file and sets its modification time.

__init__(local_file_path)[source]

Initialize self. See help(type(self)) for accurate signature.

class b2sdk.v1.DownloadDestBytes[source]

Store a downloaded file into bytes in memory.

__init__()[source]

Initialize self. See help(type(self)) for accurate signature.

class b2sdk.v1.DownloadDestProgressWrapper[source]

Wrap a DownloadDestination and report progress to a ProgressListener.

__init__(download_dest, progress_listener)[source]

Initialize self. See help(type(self)) for accurate signature.

class b2sdk.v1.PreSeekedDownloadDest[source]

Store 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.

__init__(local_file_path, seek_target)[source]

Initialize self. See help(type(self)) for accurate signature.