Skip to main content

bytes_as_timedelta

Converts a byte string representing a duration into a Python timedelta object.

def bytes_as_timedelta(
byte_count: int,
bitrate_kbps: int = 128
) - > timedelta

Converts a byte count into a timedelta object representing the estimated transfer duration at a fixed bitrate.

Parameters

NameTypeDescription
byte_countintThe total number of bytes to be processed or transferred.
bitrate_kbpsint = 128The transfer speed in kilobits per second used to calculate the duration.

Returns

TypeDescription
timedeltaA timedelta object representing the calculated duration based on the input size and bitrate.