Skip to content

rawSizeToLeafCount

rawSizeToLeafCount(rawSize): bigint

Defined in: packages/synapse-core/src/utils/pdp-size.ts:31

Calculate the PDP data-bearing leaf count for a known raw piece size.

PieceCID construction expands 127 raw bytes into four 32-byte leaves. PDP excludes leaves that contain only zero padding, so a partially occupied leaf is counted in full. The result depends only on the raw size, not the piece contents.

ParameterTypeDescription
rawSizebigintExact raw payload size for one piece, in bytes

bigint

Number of data-bearing 32-byte leaves PDP records for the piece