Skip to main content

Class: MantarayNode

Defined in: bee-js/src/manifest/manifest.ts:77

bee-js's Bee-client-coupled view of a Mantaray node: the trie structure, marshaling, and byte-level operations all delegate to core-sdk's MantarayNode; this class only adds what needs a live Bee instance (uploading/downloading, ACT history, feed resolution).

Constructors​

Constructor​

new MantarayNode(core): MantarayNode

Defined in: bee-js/src/manifest/manifest.ts:80

Parameters​

core​

MantarayNode = ...

Returns​

MantarayNode

Properties​

core​

readonly core: MantarayNode

Defined in: bee-js/src/manifest/manifest.ts:78

Accessors​

forks​

Get Signature​

get forks(): Map<number, { node: MantarayNode; prefix: Uint8Array; }>

Defined in: bee-js/src/manifest/manifest.ts:104

Returns​

Map<number, { node: MantarayNode; prefix: Uint8Array; }>


fullPath​

Get Signature​

get fullPath(): Uint8Array

Defined in: bee-js/src/manifest/manifest.ts:116

Returns​

Uint8Array


fullPathString​

Get Signature​

get fullPathString(): string

Defined in: bee-js/src/manifest/manifest.ts:120

Returns​

string


metadata​

Get Signature​

get metadata(): Record<string, string> | null | undefined

Defined in: bee-js/src/manifest/manifest.ts:96

Returns​

Record<string, string> | null | undefined


obfuscationKey​

Get Signature​

get obfuscationKey(): Uint8Array

Defined in: bee-js/src/manifest/manifest.ts:84

Returns​

Uint8Array


parent​

Get Signature​

get parent(): MantarayNode | null

Defined in: bee-js/src/manifest/manifest.ts:108

Returns​

MantarayNode | null


path​

Get Signature​

get path(): Uint8Array

Defined in: bee-js/src/manifest/manifest.ts:100

Returns​

Uint8Array


selfAddress​

Get Signature​

get selfAddress(): Uint8Array<ArrayBufferLike> | null

Defined in: bee-js/src/manifest/manifest.ts:88

Returns​

Uint8Array<ArrayBufferLike> | null


targetAddress​

Get Signature​

get targetAddress(): Uint8Array

Defined in: bee-js/src/manifest/manifest.ts:92

Returns​

Uint8Array


type​

Get Signature​

get type(): number | null

Defined in: bee-js/src/manifest/manifest.ts:112

Returns​

number | null

Methods​

addFork()​

addFork(path, reference, metadata?): void

Defined in: bee-js/src/manifest/manifest.ts:212

Adds a fork to the node.

Parameters​

path​

string | Uint8Array<ArrayBufferLike>

reference​

string | Uint8Array<ArrayBufferLike> | Bytes | Reference

metadata?​

Record<string, string> | null

Returns​

void


calculateSelfAddress()​

calculateSelfAddress(): Promise<Reference>

Defined in: bee-js/src/manifest/manifest.ts:230

Calculates the self address of the node.

Returns​

Promise<Reference>


collect()​

collect(nodes): MantarayNode[]

Defined in: bee-js/src/manifest/manifest.ts:272

Returns an array of all nodes in the tree which have a target address set.

Must be called after loadRecursively.

Parameters​

nodes​

MantarayNode[] = []

Returns​

MantarayNode[]


collectAndMap()​

collectAndMap(): Record<string, string>

Defined in: bee-js/src/manifest/manifest.ts:281

Returns a path:reference map of all nodes in the tree which have a target address set.

Must be called after loadRecursively.

Returns​

Record<string, string>


determineType()​

determineType(): number

Defined in: bee-js/src/manifest/manifest.ts:285

Returns​

number


find()​

find(path): MantarayNode | null

Defined in: bee-js/src/manifest/manifest.ts:256

Finds a node in the tree by its path.

Parameters​

path​

string | Uint8Array<ArrayBufferLike>

Returns​

MantarayNode | null


findClosest()​

findClosest(path, current?): [MantarayNode, Uint8Array<ArrayBufferLike>]

Defined in: bee-js/src/manifest/manifest.ts:263

Finds the closest node in the tree to the given path.

Parameters​

path​

string | Uint8Array<ArrayBufferLike>

current?​

Uint8Array<ArrayBufferLike>

Returns​

[MantarayNode, Uint8Array<ArrayBufferLike>]


getDocsMetadata()​

getDocsMetadata(): object

Defined in: bee-js/src/manifest/manifest.ts:140

Returns the swarm-index-document and swarm-error-document metadata values.

Returns​

object

errorDocument​

errorDocument: string | null

indexDocument​

indexDocument: string | null


getRootMetadata()​

getRootMetadata(): Optional<Record<string, string>>

Defined in: bee-js/src/manifest/manifest.ts:127

Returns the metadata at the / path to access idiomatic properties.

Returns​

Optional<Record<string, string>>


loadRecursively()​

loadRecursively(bee, options?, requestOptions?): Promise<void>

Defined in: bee-js/src/manifest/manifest.ts:249

Loads the node and its children recursively.

Parameters​

bee​

Bee

options?​

DownloadOptions

requestOptions?​

BeeRequestOptions

Returns​

Promise<void>


marshal()​

marshal(): Promise<Uint8Array<ArrayBufferLike>>

Defined in: bee-js/src/manifest/manifest.ts:179

Gets the binary representation of the node.

Returns​

Promise<Uint8Array<ArrayBufferLike>>


removeFork()​

removeFork(path): void

Defined in: bee-js/src/manifest/manifest.ts:223

Removes a fork from the node.

Parameters​

path​

string | Uint8Array<ArrayBufferLike>

Returns​

void


resolveFeed()​

resolveFeed(bee, requestOptions?): Promise<Optional<FeedPayloadResult>>

Defined in: bee-js/src/manifest/manifest.ts:159

Attempts to resolve the manifest as a feed, returning the latest update.

Parameters​

bee​

Bee

requestOptions?​

BeeRequestOptions

Returns​

Promise<Optional<FeedPayloadResult>>


saveRecursively()​

saveRecursively(bee, postageBatchId, options?, requestOptions?): Promise<UploadResult>

Defined in: bee-js/src/manifest/manifest.ts:237

Saves the node and its children recursively.

Parameters​

bee​

Bee

postageBatchId​

string | BatchId

options?​

UploadOptions

requestOptions?​

BeeRequestOptions

Returns​

Promise<UploadResult>


unmarshal()​

static unmarshal(bee, reference, options?, requestOptions?): Promise<MantarayNode>

Defined in: bee-js/src/manifest/manifest.ts:188

Downloads and unmarshals a MantarayNode from the given reference.

Do not forget calling loadRecursively on the returned node to load the entire tree.

Parameters​

bee​

Bee

reference​

string | Uint8Array<ArrayBufferLike> | Reference

options?​

DownloadOptions

requestOptions?​

BeeRequestOptions

Returns​

Promise<MantarayNode>


unmarshalFromData()​

static unmarshalFromData(data, selfAddress): MantarayNode

Defined in: bee-js/src/manifest/manifest.ts:205

Unmarshals a MantarayNode from the given data.

Do not forget calling loadRecursively on the returned node to load the entire tree.

Parameters​

data​

Uint8Array

selfAddress​

Uint8Array

Returns​

MantarayNode

💬 Get Help