import { CID } from './index.js'; import type * as API from './interface.js'; /** * @template T - Logical type of the data encoded in the block * @template C - multicodec code corresponding to codec used to encode the block * @template A - multicodec code corresponding to the hashing algorithm used in CID creation. * @template V - CID version */ export declare class Block implements API.BlockView { readonly cid: CID; readonly bytes: API.ByteView; readonly value: T; readonly asBlock: this; constructor({ cid, bytes, value }: { cid: CID; bytes: API.ByteView; value: T; }); links(): Iterable<[string, CID]>; tree(): Iterable; get(path?: string): API.BlockCursorView; } interface EncodeInput { value: T; codec: API.BlockEncoder; hasher: API.MultihashHasher; } /** * @template T - Logical type of the data encoded in the block * @template Code - multicodec code corresponding to codec used to encode the block * @template Alg - multicodec code corresponding to the hashing algorithm used in CID creation. */ export declare function encode({ value, codec, hasher }: EncodeInput): Promise>; interface DecodeInput { bytes: API.ByteView; codec: API.BlockDecoder; hasher: API.MultihashHasher; } /** * @template T - Logical type of the data encoded in the block * @template Code - multicodec code corresponding to codec used to encode the block * @template Alg - multicodec code corresponding to the hashing algorithm used in CID creation. */ export declare function decode({ bytes, codec, hasher }: DecodeInput): Promise>; type CreateUnsafeInput = { cid: API.Link; value: T; codec?: API.BlockDecoder; bytes: API.ByteView; } | { cid: API.Link; value?: undefined; codec: API.BlockDecoder; bytes: API.ByteView; }; /** * @template T - Logical type of the data encoded in the block * @template Code - multicodec code corresponding to codec used to encode the block * @template Alg - multicodec code corresponding to the hashing algorithm used in CID creation. * @template V - CID version */ export declare function createUnsafe({ bytes, cid, value: maybeValue, codec }: CreateUnsafeInput): API.BlockView; interface CreateInput { bytes: API.ByteView; cid: API.Link; hasher: API.MultihashHasher; codec: API.BlockDecoder; } /** * @template T - Logical type of the data encoded in the block * @template Code - multicodec code corresponding to codec used to encode the block * @template Alg - multicodec code corresponding to the hashing algorithm used in CID creation. * @template V - CID version */ export declare function create({ bytes, cid, hasher, codec }: CreateInput): Promise>; export {}; //# sourceMappingURL=block.d.ts.map