getSizeFromPieceCID
function getSizeFromPieceCID(pieceCidInput): number;
Defined in: packages/synapse-sdk/src/piece/piece.ts:220
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.
Parameters
Section titled “Parameters”Parameter | Type | Description |
---|---|---|
pieceCidInput | | string | PieceLink | CID <unknown , number , number , Version > | PieceCID as either a CID object or string |
Returns
Section titled “Returns”number
The raw size in bytes
Throws
Section titled “Throws”If the input is not a valid PieceCIDv2