chunkCountForPlaintext
chunkCountForPlaintext(
plaintextLength,chunkSize):number
Defined in: packages/filecoin-encryption-envelope/src/chunk-layout.ts:121
Chunk count for a plaintext of the given length: max(1, ceil(P / S)).
The max matters — ceil(0 / S) is zero, and empty plaintext is still
one chunk, carrying nothing but its tag.
Use this to predict a layout from a plaintext length, never to validate
a stored one. A declared plaintext_length is checked through
ciphertextLengthForPlaintext against the observed ciphertext
length, never by running this in reverse.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
plaintextLength | number |
chunkSize | number |
Returns
Section titled “Returns”number