Write intent

class b2sdk.v2.WriteIntent[source]

Wrapper for outbound source that defines destination offset.

__init__(outbound_source, destination_offset=0)[source]
Parameters:
property length

Length of the write intent.

Return type:

int

property destination_end_offset

Offset of source end in destination file.

Return type:

int

is_copy()[source]

States if outbound source is remote source and requires copying.

Return type:

bool

is_upload()[source]

States if outbound source is local source and requires uploading.

Return type:

bool

get_content_sha1()[source]

Return a 40-character string containing the hex SHA1 checksum, which can be used as the large_file_sha1 entry.

This method is only used if a large file is constructed from only a single source. If that source’s hash is known, the result file’s SHA1 checksum will be the same and can be copied.

If the source’s sha1 is unknown and can’t be calculated, None is returned.

Rtype str:

Return type:

Optional[NewType(Sha1HexDigest, str)]

classmethod wrap_sources_iterator(outbound_sources_iterator)[source]

Helper that wraps outbound sources iterator with write intents.

Can be used in cases similar to concatenate to automatically compute destination offsets

Param:

iterator[b2sdk.v2.OutboundTransferSource] outbound_sources_iterator: iterator of outbound sources

Return type:

generator[b2sdk.v2.WriteIntent]