Skip to content

getSize

function getSize(pieceCid): number;

Defined in: packages/synapse-core/src/piece.ts:32

Extract the raw (unpadded) size from a PieceCIDv2

PieceCIDv2 encodes the original data size in its multihash digest through the tree height and padding values. This function decodes those values to calculate the original raw data size.

ParameterTypeDescription
pieceCidPieceLinkPieceCID

number

The raw size in bytes

If the input is not a valid PieceCIDv2