Skip to content

SIZE_CONSTANTS

const SIZE_CONSTANTS: object;

Defined in: packages/synapse-core/src/utils/constants.ts:34

Data size constants

readonly DEFAULT_UPLOAD_BATCH_SIZE: 32 = 32;

Default number of uploads to batch together in a single addPieces transaction This balances gas efficiency with reasonable transaction sizes

readonly GiB: bigint;

Bytes in 1 GiB

readonly KiB: 1024n = 1024n;

Bytes in 1 KiB

readonly MAX_UPLOAD_SIZE: 1065353216 = 1_065_353_216;

Maximum upload size currently supported by PDP servers.

1 GiB adjusted for fr32 expansion: 1 GiB * (127/128) = 1,065,353,216 bytes

Fr32 encoding adds 2 bits of padding per 254 bits of data, resulting in 128 bytes of padded data for every 127 bytes of raw data.

Note: While it’s technically possible to upload pieces this large as Uint8Array, streaming via AsyncIterable is strongly recommended for non-trivial sizes. See SIZE_CONSTANTS.MAX_UPLOAD_SIZE in synapse-sdk for detailed guidance.

readonly MiB: bigint;

Bytes in 1 MiB

readonly MIN_UPLOAD_SIZE: 127 = 127;

Minimum upload size (127 bytes) PieceCIDv2 calculation requires at least 127 bytes payload

readonly PiB: bigint;

Bytes in 1 PiB

readonly TiB: bigint;

Bytes in 1 TiB