@ethersphere/bee-js
Version:
Javascript client for Bee
27 lines (26 loc) • 873 B
TypeScript
import { Bytes } from '../utils/bytes';
import { Reference, Span } from '../utils/typed-bytes';
export declare const MIN_PAYLOAD_SIZE = 1;
export declare const MAX_PAYLOAD_SIZE = 4096;
/**
* General chunk interface for Swarm
*
* It stores the serialized data and provides functions to access
* the fields of a chunk.
*
* It also provides an address function to calculate the address of
* the chunk that is required for the Chunk API.
*/
export interface Chunk {
readonly data: Uint8Array;
span: Span;
payload: Bytes;
address: Reference;
}
/**
* Creates a content addressed chunk and verifies the payload size.
*
* @param payloadBytes the data to be stored in the chunk
*/
export declare function makeContentAddressedChunk(payloadBytes: Uint8Array | string): Chunk;
export declare function asContentAddressedChunk(chunkBytes: Uint8Array): Chunk;