calculate_padding

asdf.util.calculate_padding(content_size, pad_blocks, block_size)[source]

Calculates the amount of extra space to add to a block given the user’s request for the amount of extra space. Care is given so that the total of size of the block with padding is evenly divisible by block size.

Parameters:
content_sizeint

The size of the actual content

pad_blocksfloat or bool

If False, add no padding (always return 0). If True, add a default amount of padding of 10% If a float, it is a factor to multiple content_size by to get the new total size.

block_sizeint

The filesystem block size to use.

Returns:
nbytesint

The number of extra bytes to add for padding.