# bee-js Documentation > bee-js is the official JavaScript/TypeScript SDK for building applications on Swarm, a decentralised storage and communication network. This file contains all documentation content in a single document following the llmstxt.org standard. ## Overview ## Namespaces - [Utils](./namespaces/Utils/approximateOverheadForRedundancyLevel.md) ## Enumerations - [BeeModes](enumerations/BeeModes.md) - [RedundancyLevel](enumerations/RedundancyLevel.md) - [RedundancyStrategy](enumerations/RedundancyStrategy.md) ## Classes - [Balance](classes/Balance.md) - [BatchId](classes/BatchId.md) - [Bee](classes/Bee.md) - [BeeArgumentError](classes/BeeArgumentError.md) - [BeeError](classes/BeeError.md) - [BeeResponseError](classes/BeeResponseError.md) - [Bytes](classes/Bytes.md) - [BZZ](classes/BZZ.md) - [Cheque](classes/Cheque.md) - [Chequebook](classes/Chequebook.md) - [Chunk](classes/Chunk.md) - [ChunkBuilder](classes/ChunkBuilder.md) - [ChunkSplitter](classes/ChunkSplitter.md) - [Collection](classes/Collection.md) - [Connectivity](classes/Connectivity.md) - [DAI](classes/DAI.md) - [Data](classes/Data.md) - [Duration](classes/Duration.md) - [EthAddress](classes/EthAddress.md) - [Feed](classes/Feed.md) - [FeedIndex](classes/FeedIndex.md) - [File](classes/File.md) - [Grantee](classes/Grantee.md) - [Identifier](classes/Identifier.md) - [MantarayNode](classes/MantarayNode.md) - [Messaging](classes/Messaging.md) - [PeerAddress](classes/PeerAddress.md) - [Pin](classes/Pin.md) - [PrivateKey](classes/PrivateKey.md) - [PublicKey](classes/PublicKey.md) - [Reference](classes/Reference.md) - [RollingFeed](classes/RollingFeed.md) - [RollingFeedReader](classes/RollingFeedReader.md) - [RollingFeedWriter](classes/RollingFeedWriter.md) - [Settlement](classes/Settlement.md) - [Signature](classes/Signature.md) - [Size](classes/Size.md) - [Soc](classes/Soc.md) - [Span](classes/Span.md) - [Stake](classes/Stake.md) - [Stamp](classes/Stamp.md) - [Stamper](classes/Stamper.md) - [Status](classes/Status.md) - [Storage](classes/Storage.md) - [Tag](classes/Tag.md) - [Topic](classes/Topic.md) - [Transaction](classes/Transaction.md) - [TransactionId](classes/TransactionId.md) - [Wallet](classes/Wallet.md) ## Interfaces - [AllSettlements](interfaces/AllSettlements.md) - [AllTagsOptions](interfaces/AllTagsOptions.md) - [BalanceResponse](interfaces/BalanceResponse.md) - [BatchBucket](interfaces/BatchBucket.md) - [BeeOptions](interfaces/BeeOptions.md) - [BeeRequest](interfaces/BeeRequest.md) - [BeeResponse](interfaces/BeeResponse.md) - [BeeVersions](interfaces/BeeVersions.md) - [Bin](interfaces/Bin.md) - [CashoutResult](interfaces/CashoutResult.md) - [ChainState](interfaces/ChainState.md) - [Cheque](interfaces/Cheque.md) - [ChequebookAddressResponse](interfaces/ChequebookAddressResponse.md) - [ChequebookBalanceResponse](interfaces/ChequebookBalanceResponse.md) - [Chunk](interfaces/Chunk.md) - [ChunkUploadOptions](interfaces/ChunkUploadOptions.md) - [CollectionEntry](interfaces/CollectionEntry.md) - [CollectionUploadOptions](interfaces/CollectionUploadOptions.md) - [Data](interfaces/Data.md) - [DebugStatus](interfaces/DebugStatus.md) - [DownloadOptions](interfaces/DownloadOptions.md) - [Envelope](interfaces/Envelope.md) - [EnvelopeWithBatchId](interfaces/EnvelopeWithBatchId.md) - [FeedReader](interfaces/FeedReader.md) - [FeedWriter](interfaces/FeedWriter.md) - [FileData](interfaces/FileData.md) - [FileHeaders](interfaces/FileHeaders.md) - [FileUploadOptions](interfaces/FileUploadOptions.md) - [GetGranteesResult](interfaces/GetGranteesResult.md) - [GlobalPostageBatch](interfaces/GlobalPostageBatch.md) - [GranteesResult](interfaces/GranteesResult.md) - [GsocMessageHandler](interfaces/GsocMessageHandler.md) - [GsocSubscribeOptions](interfaces/GsocSubscribeOptions.md) - [GsocSubscription](interfaces/GsocSubscription.md) - [Health](interfaces/Health.md) - [LastCashoutActionResponse](interfaces/LastCashoutActionResponse.md) - [LastChequesForPeerResponse](interfaces/LastChequesForPeerResponse.md) - [LastChequesResponse](interfaces/LastChequesResponse.md) - [NodeAddresses](interfaces/NodeAddresses.md) - [NodeInfo](interfaces/NodeInfo.md) - [Peer](interfaces/Peer.md) - [PeerBalance](interfaces/PeerBalance.md) - [Pin](interfaces/Pin.md) - [PingResponse](interfaces/PingResponse.md) - [PostageBatch](interfaces/PostageBatch.md) - [PostageBatchBuckets](interfaces/PostageBatchBuckets.md) - [PostageBatchOptions](interfaces/PostageBatchOptions.md) - [PssMessageHandler](interfaces/PssMessageHandler.md) - [PssSubscription](interfaces/PssSubscription.md) - [Readiness](interfaces/Readiness.md) - [RedistributionState](interfaces/RedistributionState.md) - [RedundantUploadOptions](interfaces/RedundantUploadOptions.md) - [ReferenceInformation](interfaces/ReferenceInformation.md) - [ReferenceResponse](interfaces/ReferenceResponse.md) - [RemovePeerResponse](interfaces/RemovePeerResponse.md) - [ReserveState](interfaces/ReserveState.md) - [Settlements](interfaces/Settlements.md) - [SingleOwnerChunk](interfaces/SingleOwnerChunk.md) - [SOCReader](interfaces/SOCReader.md) - [SOCWriter](interfaces/SOCWriter.md) - [Tag](interfaces/Tag.md) - [Topology](interfaces/Topology.md) - [TransactionInfo](interfaces/TransactionInfo.md) - [TransactionOptions](interfaces/TransactionOptions.md) - [TransactionResponse](interfaces/TransactionResponse.md) - [UploadHeaders](interfaces/UploadHeaders.md) - [UploadOptions](interfaces/UploadOptions.md) - [UploadProgress](interfaces/UploadProgress.md) - [UploadResult](interfaces/UploadResult.md) - [WalletBalance](interfaces/WalletBalance.md) ## Type Aliases - [BeeRequestOptions](type-aliases/BeeRequestOptions.md) - [Collection](type-aliases/Collection.md) - [GsocField](type-aliases/GsocField.md) - [HookCallback](type-aliases/HookCallback.md) - [HttpMethod](type-aliases/HttpMethod.md) - [NumberString](type-aliases/NumberString.md) ## Variables - [BRANCHES](variables/BRANCHES.md) - [capacityBreakpoints](variables/capacityBreakpoints.md) - [CHUNK\_SIZE](variables/CHUNK_SIZE.md) - [NULL\_ADDRESS](variables/NULL_ADDRESS.md) - [NULL\_IDENTIFIER](variables/NULL_IDENTIFIER.md) - [NULL\_OWNER](variables/NULL_OWNER.md) - [NULL\_STAMP](variables/NULL_STAMP.md) - [NULL\_TOPIC](variables/NULL_TOPIC.md) - [PSS\_TARGET\_HEX\_LENGTH\_MAX](variables/PSS_TARGET_HEX_LENGTH_MAX.md) - [SECTION\_SIZE](variables/SECTION_SIZE.md) - [STAMPS\_DEPTH\_MAX](variables/STAMPS_DEPTH_MAX.md) - [STAMPS\_DEPTH\_MIN](variables/STAMPS_DEPTH_MIN.md) - [SUPPORTED\_BEE\_VERSION](variables/SUPPORTED_BEE_VERSION.md) - [SUPPORTED\_BEE\_VERSION\_EXACT](variables/SUPPORTED_BEE_VERSION_EXACT.md) - [SWARM\_GATEWAY\_URL](variables/SWARM_GATEWAY_URL.md) - [TAGS\_LIMIT\_MAX](variables/TAGS_LIMIT_MAX.md) - [TAGS\_LIMIT\_MIN](variables/TAGS_LIMIT_MIN.md) ## Functions - [toBeeMode](functions/toBeeMode.md) ## References ### RollingFeedReader Re-exports [RollingFeedReader](classes/RollingFeedReader.md) *** ### RollingFeedWriter Re-exports [RollingFeedWriter](classes/RollingFeedWriter.md) --- ## Class: BZZ Defined in: [bee-js/src/utils/tokens.ts:4](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/utils/tokens.ts#L4) ## Properties ### DIGITS > `readonly` `static` **DIGITS**: `16` = `16` Defined in: [bee-js/src/utils/tokens.ts:5](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/utils/tokens.ts#L5) ## Methods ### divide() > **divide**(`other`): `BZZ` Defined in: [bee-js/src/utils/tokens.ts:71](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/utils/tokens.ts#L71) Does not mutate the current BZZ instance. #### Parameters ##### other `bigint` Divisor #### Returns `BZZ` New BZZ instance *** ### eq() > **eq**(`other`): `boolean` Defined in: [bee-js/src/utils/tokens.ts:91](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/utils/tokens.ts#L91) #### Parameters ##### other `BZZ` #### Returns `boolean` *** ### exchangeToDAI() > **exchangeToDAI**(`daiPerBzz`): [`DAI`](DAI.md) Defined in: [bee-js/src/utils/tokens.ts:95](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/utils/tokens.ts#L95) #### Parameters ##### daiPerBzz [`DAI`](DAI.md) #### Returns [`DAI`](DAI.md) *** ### gt() > **gt**(`other`): `boolean` Defined in: [bee-js/src/utils/tokens.ts:75](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/utils/tokens.ts#L75) #### Parameters ##### other `BZZ` #### Returns `boolean` *** ### gte() > **gte**(`other`): `boolean` Defined in: [bee-js/src/utils/tokens.ts:79](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/utils/tokens.ts#L79) #### Parameters ##### other `BZZ` #### Returns `boolean` *** ### lt() > **lt**(`other`): `boolean` Defined in: [bee-js/src/utils/tokens.ts:83](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/utils/tokens.ts#L83) #### Parameters ##### other `BZZ` #### Returns `boolean` *** ### lte() > **lte**(`other`): `boolean` Defined in: [bee-js/src/utils/tokens.ts:87](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/utils/tokens.ts#L87) #### Parameters ##### other `BZZ` #### Returns `boolean` *** ### minus() > **minus**(`other`): `BZZ` Defined in: [bee-js/src/utils/tokens.ts:61](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/utils/tokens.ts#L61) Does not mutate the current BZZ instance. #### Parameters ##### other BZZ instance, or amount in PLUR `string` | `bigint` | [`NumberString`](../type-aliases/NumberString.md) | `BZZ` #### Returns `BZZ` New BZZ instance *** ### plus() > **plus**(`other`): `BZZ` Defined in: [bee-js/src/utils/tokens.ts:51](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/utils/tokens.ts#L51) Does not mutate the current BZZ instance. #### Parameters ##### other BZZ instance, or amount in PLUR `string` | `bigint` | [`NumberString`](../type-aliases/NumberString.md) | `BZZ` #### Returns `BZZ` New BZZ instance *** ### toDecimalString() > **toDecimalString**(): `string` Defined in: [bee-js/src/utils/tokens.ts:33](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/utils/tokens.ts#L33) #### Returns `string` *** ### toFloat() > **toFloat**(): `number` Defined in: [bee-js/src/utils/tokens.ts:37](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/utils/tokens.ts#L37) #### Returns `number` *** ### toPLURBigInt() > **toPLURBigInt**(): `bigint` Defined in: [bee-js/src/utils/tokens.ts:29](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/utils/tokens.ts#L29) #### Returns `bigint` *** ### toPLURString() > **toPLURString**(): `string` Defined in: [bee-js/src/utils/tokens.ts:25](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/utils/tokens.ts#L25) #### Returns `string` *** ### toSignificantDigits() > **toSignificantDigits**(`digits`): `string` Defined in: [bee-js/src/utils/tokens.ts:41](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/utils/tokens.ts#L41) #### Parameters ##### digits `number` #### Returns `string` *** ### fromDecimalString() > `static` **fromDecimalString**(`string`): `BZZ` Defined in: [bee-js/src/utils/tokens.ts:13](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/utils/tokens.ts#L13) #### Parameters ##### string `string` #### Returns `BZZ` *** ### fromFloat() > `static` **fromFloat**(`float`): `BZZ` Defined in: [bee-js/src/utils/tokens.ts:21](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/utils/tokens.ts#L21) #### Parameters ##### float `number` #### Returns `BZZ` *** ### fromPLUR() > `static` **fromPLUR**(`plur`): `BZZ` Defined in: [bee-js/src/utils/tokens.ts:17](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/utils/tokens.ts#L17) #### Parameters ##### plur `string` | `bigint` | [`NumberString`](../type-aliases/NumberString.md) #### Returns `BZZ` --- ## Class: Balance Defined in: [bee-js/src/modules/balance.ts:12](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/modules/balance.ts#L12) SWAP balance operations. Related to the bandwidth incentives and the chequebook. Accessed as `bee.balance`. ## Constructors ### Constructor > **new Balance**(`context`): `Balance` Defined in: [bee-js/src/modules/balance.ts:13](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/modules/balance.ts#L13) #### Parameters ##### context `BeeContext` #### Returns `Balance` ## Methods ### getAll() > **getAll**(`requestOptions?`): `Promise`\<[`BalanceResponse`](../interfaces/BalanceResponse.md)\> Defined in: [bee-js/src/modules/balance.ts:20](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/modules/balance.ts#L20) Gets the SWAP balances with all known peers including prepaid services. #### Parameters ##### requestOptions? [`BeeRequestOptions`](../type-aliases/BeeRequestOptions.md) Options for making requests, such as timeouts, custom HTTP agents, headers, etc. #### Returns `Promise`\<[`BalanceResponse`](../interfaces/BalanceResponse.md)\> *** ### getAllPastDueConsumption() > **getAllPastDueConsumption**(`requestOptions?`): `Promise`\<[`BalanceResponse`](../interfaces/BalanceResponse.md)\> Defined in: [bee-js/src/modules/balance.ts:41](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/modules/balance.ts#L41) Gets the past due consumption balances for all known peers. #### Parameters ##### requestOptions? [`BeeRequestOptions`](../type-aliases/BeeRequestOptions.md) Options for making requests, such as timeouts, custom HTTP agents, headers, etc. #### Returns `Promise`\<[`BalanceResponse`](../interfaces/BalanceResponse.md)\> *** ### getAllPastDueConsumptionForPeer() > **getAllPastDueConsumptionForPeer**(`address`, `requestOptions?`): `Promise`\<[`PeerBalance`](../interfaces/PeerBalance.md)\> Defined in: [bee-js/src/modules/balance.ts:51](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/modules/balance.ts#L51) Gets the past due consumption balance for a specific peer. #### Parameters ##### address Swarm address of peer `string` | [`PeerAddress`](../classes/PeerAddress.md) ##### requestOptions? [`BeeRequestOptions`](../type-aliases/BeeRequestOptions.md) Options for making requests, such as timeouts, custom HTTP agents, headers, etc. #### Returns `Promise`\<[`PeerBalance`](../interfaces/PeerBalance.md)\> *** ### getPeer() > **getPeer**(`address`, `requestOptions?`): `Promise`\<[`PeerBalance`](../interfaces/PeerBalance.md)\> Defined in: [bee-js/src/modules/balance.ts:30](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/modules/balance.ts#L30) Gets the SWAP balances for a specific peer including prepaid services. #### Parameters ##### address Swarm address of peer `string` | [`PeerAddress`](../classes/PeerAddress.md) ##### requestOptions? [`BeeRequestOptions`](../type-aliases/BeeRequestOptions.md) Options for making requests, such as timeouts, custom HTTP agents, headers, etc. #### Returns `Promise`\<[`PeerBalance`](../interfaces/PeerBalance.md)\> --- ## Class: BatchId Defined in: [core-sdk/src/bytes/batch-id.ts:6](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/batch-id.ts#L6) A 32-byte postage batch identifier. ## Extends - [`Bytes`](Bytes.md) ## Constructors ### Constructor > **new BatchId**(`bytes`): `BatchId` Defined in: [core-sdk/src/bytes/batch-id.ts:9](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/batch-id.ts#L9) #### Parameters ##### bytes `string` | `Uint8Array`\<`ArrayBufferLike`\> | [`Bytes`](Bytes.md) #### Returns `BatchId` #### Overrides [`Bytes`](Bytes.md).[`constructor`](Bytes.md#constructor) ## Properties ### length > `readonly` **length**: `number` Defined in: [core-sdk/src/bytes/bytes.ts:19](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L19) #### Inherited from [`Bytes`](Bytes.md).[`length`](Bytes.md#length) *** ### LENGTH > `readonly` `static` **LENGTH**: `32` = `32` Defined in: [core-sdk/src/bytes/batch-id.ts:7](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/batch-id.ts#L7) ## Methods ### equals() > **equals**(`other`): `boolean` Defined in: [core-sdk/src/bytes/bytes.ts:173](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L173) Byte-wise equality against another Bytes instance, raw bytes, or hex string. #### Parameters ##### other `string` | `Uint8Array`\<`ArrayBufferLike`\> | [`Bytes`](Bytes.md) #### Returns `boolean` #### Inherited from [`Bytes`](Bytes.md).[`equals`](Bytes.md#equals) *** ### offset() > **offset**(`index`): `Uint8Array` Defined in: [core-sdk/src/bytes/bytes.ts:110](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L110) Returns a copy of the bytes from `index` to the end. #### Parameters ##### index `number` #### Returns `Uint8Array` #### Inherited from [`Bytes`](Bytes.md).[`offset`](Bytes.md#offset) *** ### parsePayloadAsJson() > **parsePayloadAsJson**(): `unknown` Defined in: [core-sdk/src/bytes/bytes.ts:159](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L159) Parses the bytes as UTF-8 JSON. #### Returns `unknown` #### Inherited from [`Bytes`](Bytes.md).[`parsePayloadAsJson`](Bytes.md#parsepayloadasjson) *** ### represent() > **represent**(): `string` Defined in: [core-sdk/src/bytes/bytes.ts:180](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L180) Human-readable representation, used by debuggers/loggers. Same as [toHex](Bytes.md#tohex). #### Returns `string` #### Inherited from [`Bytes`](Bytes.md).[`represent`](Bytes.md#represent) *** ### toBase32() > **toBase32**(): `string` Defined in: [core-sdk/src/bytes/bytes.ts:138](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L138) Encodes as a padded base32 string. #### Returns `string` #### Inherited from [`Bytes`](Bytes.md).[`toBase32`](Bytes.md#tobase32) *** ### toBase64() > **toBase64**(): `string` Defined in: [core-sdk/src/bytes/bytes.ts:131](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L131) Encodes as a padded base64 string. #### Returns `string` #### Inherited from [`Bytes`](Bytes.md).[`toBase64`](Bytes.md#tobase64) *** ### toHex() > **toHex**(): `string` Defined in: [core-sdk/src/bytes/bytes.ts:124](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L124) Encodes as a lowercase hex string, with no `0x` prefix. #### Returns `string` #### Inherited from [`Bytes`](Bytes.md).[`toHex`](Bytes.md#tohex) *** ### toJSON() > **toJSON**(): `string` Defined in: [core-sdk/src/bytes/bytes.ts:166](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L166) Serialized as its hex string by `JSON.stringify`. #### Returns `string` #### Inherited from [`Bytes`](Bytes.md).[`toJSON`](Bytes.md#tojson) *** ### toString() > **toString**(): `string` Defined in: [core-sdk/src/bytes/bytes.ts:145](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L145) Same as [toHex](Bytes.md#tohex). #### Returns `string` #### Inherited from [`Bytes`](Bytes.md).[`toString`](Bytes.md#tostring) *** ### toUint8Array() > **toUint8Array**(): `Uint8Array` Defined in: [core-sdk/src/bytes/bytes.ts:117](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L117) Returns a copy of the underlying bytes. #### Returns `Uint8Array` #### Inherited from [`Bytes`](Bytes.md).[`toUint8Array`](Bytes.md#touint8array) *** ### toUtf8() > **toUtf8**(): `string` Defined in: [core-sdk/src/bytes/bytes.ts:152](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L152) Decodes the bytes as UTF-8 text. #### Returns `string` #### Inherited from [`Bytes`](Bytes.md).[`toUtf8`](Bytes.md#toutf8) *** ### concat() > `static` **concat**(...`arrays`): `Uint8Array` Defined in: [core-sdk/src/bytes/bytes.ts:75](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L75) Concatenates any number of byte arrays (or Bytes instances) into one new array. #### Parameters ##### arrays ...(`Uint8Array`\<`ArrayBufferLike`\> \| [`Bytes`](Bytes.md))[] #### Returns `Uint8Array` #### Inherited from [`Bytes`](Bytes.md).[`concat`](Bytes.md#concat) *** ### fromSlice() > `static` **fromSlice**(`bytes`, `start`, `length?`): [`Bytes`](Bytes.md) Defined in: [core-sdk/src/bytes/bytes.ts:100](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L100) Wraps a slice of `bytes` starting at `start`, running to the end unless `length` is given. #### Parameters ##### bytes `Uint8Array` ##### start `number` ##### length? `number` #### Returns [`Bytes`](Bytes.md) #### Inherited from [`Bytes`](Bytes.md).[`fromSlice`](Bytes.md#fromslice) *** ### fromUtf8() > `static` **fromUtf8**(`utf8`): [`Bytes`](Bytes.md) Defined in: [core-sdk/src/bytes/bytes.ts:92](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L92) Wraps the UTF-8 encoding of a string. #### Parameters ##### utf8 `string` #### Returns [`Bytes`](Bytes.md) #### Inherited from [`Bytes`](Bytes.md).[`fromUtf8`](Bytes.md#fromutf8) *** ### keccak256() > `static` **keccak256**(`bytes`): [`Bytes`](Bytes.md) Defined in: [core-sdk/src/bytes/bytes.ts:68](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L68) Hashes `bytes` with keccak256 and wraps the 32-byte digest. #### Parameters ##### bytes `string` | `ArrayBuffer` | `Uint8Array`\<`ArrayBufferLike`\> | [`Bytes`](Bytes.md) #### Returns [`Bytes`](Bytes.md) #### Inherited from [`Bytes`](Bytes.md).[`keccak256`](Bytes.md#keccak256) --- ## Class: Bee Defined in: [bee-js/src/bee.ts:52](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/bee.ts#L52) The main component that abstracts operations available on the Bee API. Instantiate with `new Bee(url, options)` where `url` is the Bee node URL and `options` are optional parameters. ## Example ```ts const bee = new Bee('http://localhost:1633') ``` ## Constructors ### Constructor > **new Bee**(`url`, `options?`): `Bee` Defined in: [bee-js/src/bee.ts:93](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/bee.ts#L93) #### Parameters ##### url `string` URL on which is the main API of Bee node exposed ##### options? [`BeeOptions`](../interfaces/BeeOptions.md) #### Returns `Bee` #### Example ```ts const bee = new Bee('http://localhost:1633') ``` ## Properties ### balance > `readonly` **balance**: [`Balance`](Balance.md) Defined in: [bee-js/src/bee.ts:150](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/bee.ts#L150) SWAP balance operations. Related to the bandwidth incentives and the chequebook. *** ### cheque > `readonly` **cheque**: [`Cheque`](Cheque.md) Defined in: [bee-js/src/bee.ts:200](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/bee.ts#L200) Cheque operations (last cheques and cashouts). *** ### chequebook > `readonly` **chequebook**: [`Chequebook`](Chequebook.md) Defined in: [bee-js/src/bee.ts:195](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/bee.ts#L195) Chequebook contract operations (address, balance, deposit, withdraw). *** ### chunk > `readonly` **chunk**: [`Chunk`](Chunk.md) Defined in: [bee-js/src/bee.ts:240](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/bee.ts#L240) Chunk operations backed by the `/chunks` endpoint. *** ### collection > `readonly` **collection**: [`Collection`](Collection.md) Defined in: [bee-js/src/bee.ts:250](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/bee.ts#L250) Collection (multi-file) operations backed by the `/bzz` endpoint. *** ### connectivity > `readonly` **connectivity**: [`Connectivity`](Connectivity.md) Defined in: [bee-js/src/bee.ts:170](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/bee.ts#L170) Peer, topology and network connectivity operations. *** ### data > `readonly` **data**: [`Data`](Data.md) Defined in: [bee-js/src/bee.ts:235](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/bee.ts#L235) Raw data operations backed by the `/bytes` endpoint. *** ### feed > `readonly` **feed**: [`Feed`](Feed.md) Defined in: [bee-js/src/bee.ts:225](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/bee.ts#L225) Feed operations. *** ### file > `readonly` **file**: [`File`](File.md) Defined in: [bee-js/src/bee.ts:245](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/bee.ts#L245) Single-file operations backed by the `/bzz` endpoint. *** ### grantee > `readonly` **grantee**: [`Grantee`](Grantee.md) Defined in: [bee-js/src/bee.ts:215](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/bee.ts#L215) Grantee (access control) operations. *** ### messaging > `readonly` **messaging**: [`Messaging`](Messaging.md) Defined in: [bee-js/src/bee.ts:220](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/bee.ts#L220) Messaging protocols — PSS and GSOC. *** ### network > `readonly` **network**: `"gnosis"` \| `"sepolia"` Defined in: [bee-js/src/bee.ts:79](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/bee.ts#L79) Network on which the Bee node is running. This is currently used to determine block time for postage batch time-to-live (TTL) calculations. The block time for `gnosis` is `5` seconds, and for `sepolia` it is `15` seconds. #### Default ```ts 'gnosis' ``` *** ### pin > `readonly` **pin**: [`Pin`](Pin.md) Defined in: [bee-js/src/bee.ts:210](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/bee.ts#L210) Local pinning operations. *** ### rollingFeed > `readonly` **rollingFeed**: [`RollingFeed`](RollingFeed.md) Defined in: [bee-js/src/bee.ts:255](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/bee.ts#L255) Rolling feed operations. *** ### settlement > `readonly` **settlement**: [`Settlement`](Settlement.md) Defined in: [bee-js/src/bee.ts:155](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/bee.ts#L155) Settlement operations. Related to the bandwidth incentives and the chequebook. *** ### signer? > `readonly` `optional` **signer**: [`PrivateKey`](PrivateKey.md) Defined in: [bee-js/src/bee.ts:69](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/bee.ts#L69) Default signer (a private key) used for signing. Mainly used in single-owner chunk (SOC) related operations, and consequently in feeds. If not provided, methods such as `makeFeedWriter` and `makeSOCWriter` must be provided with a private key in their respective function calls. *** ### soc > `readonly` **soc**: [`Soc`](Soc.md) Defined in: [bee-js/src/bee.ts:230](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/bee.ts#L230) Single owner chunk (SOC) reader/writer operations. *** ### stake > `readonly` **stake**: [`Stake`](Stake.md) Defined in: [bee-js/src/bee.ts:165](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/bee.ts#L165) Staking operations. *** ### stamp > `readonly` **stamp**: [`Stamp`](Stamp.md) Defined in: [bee-js/src/bee.ts:185](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/bee.ts#L185) Low-level postage batch (stamp) operations. *** ### status > `readonly` **status**: [`Status`](Status.md) Defined in: [bee-js/src/bee.ts:175](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/bee.ts#L175) Node status, health, version and chain/reserve state operations. *** ### storage > `readonly` **storage**: [`Storage`](Storage.md) Defined in: [bee-js/src/bee.ts:190](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/bee.ts#L190) Ergonomic storage operations expressed in terms of size and duration. *** ### tag > `readonly` **tag**: [`Tag`](Tag.md) Defined in: [bee-js/src/bee.ts:205](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/bee.ts#L205) Tag operations for tracking upload and synchronization progress. *** ### transaction > `readonly` **transaction**: [`Transaction`](Transaction.md) Defined in: [bee-js/src/bee.ts:160](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/bee.ts#L160) Pending transaction operations for the Bee node's transaction queue. *** ### url > `readonly` **url**: `string` Defined in: [bee-js/src/bee.ts:59](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/bee.ts#L59) Bee node API URL. #### Example ```ts `http://localhost:1633` ``` *** ### wallet > `readonly` **wallet**: [`Wallet`](Wallet.md) Defined in: [bee-js/src/bee.ts:180](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/bee.ts#L180) Node wallet operations (balances and external withdrawals). ## Methods ### calculateSingleOwnerChunkAddress() > **calculateSingleOwnerChunkAddress**(`identifier`, `address`): [`Reference`](Reference.md) Defined in: [bee-js/src/bee.ts:312](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/bee.ts#L312) Calculates the address of a Single Owner Chunk based on its identifier and owner address. #### Parameters ##### identifier [`Identifier`](Identifier.md) ##### address [`EthAddress`](EthAddress.md) #### Returns [`Reference`](Reference.md) *** ### createEnvelope() > **createEnvelope**(`postageBatchId`, `reference`, `requestOptions?`): `Promise`\<[`EnvelopeWithBatchId`](../interfaces/EnvelopeWithBatchId.md)\> Defined in: [bee-js/src/bee.ts:345](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/bee.ts#L345) Creates the postage batch signature for a specific chunk address. This is for advanced usage, where a pre-signed chunk can be uploaded through a different Bee node. #### Parameters ##### postageBatchId `string` | `Uint8Array`\<`ArrayBufferLike`\> | [`BatchId`](BatchId.md) ##### reference `string` | `Uint8Array`\<`ArrayBufferLike`\> | [`Reference`](Reference.md) ##### requestOptions? [`BeeRequestOptions`](../type-aliases/BeeRequestOptions.md) Options for making requests, such as timeouts, custom HTTP agents, headers, etc. #### Returns `Promise`\<[`EnvelopeWithBatchId`](../interfaces/EnvelopeWithBatchId.md)\> #### Example ```ts const envelope = await bee.createEnvelope(batchId, chunk.address) await bee.chunk.upload(envelope, chunk) ``` *** ### makeContentAddressedChunk() > **makeContentAddressedChunk**(`rawPayload`, `span?`): [`Chunk`](../interfaces/Chunk.md) Defined in: [bee-js/src/bee.ts:267](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/bee.ts#L267) Creates a Content Addressed Chunk. To be uploaded with the uploadChunk method. Payload size must be between 1 and 4096 bytes. #### Parameters ##### rawPayload Data to be stored in the chunk. If the data is a string, it will be converted to UTF-8 bytes. `string` | `Uint8Array`\<`ArrayBufferLike`\> | [`Bytes`](Bytes.md) ##### span? Optional span for the chunk. If not provided, it will be set to the length of the payload. `bigint` | [`Span`](Span.md) #### Returns [`Chunk`](../interfaces/Chunk.md) *** ### makeSingleOwnerChunk() > **makeSingleOwnerChunk**(`address`, `span`, `payload`, `identifier`, `signer`): [`SingleOwnerChunk`](../interfaces/SingleOwnerChunk.md) Defined in: [bee-js/src/bee.ts:296](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/bee.ts#L296) Creates a Single Owner Chunk. To be uploaded with the uploadChunk method. Identical to chaining `makeContentAddressedChunk` and `toSingleOwnerChunk`. Payload size must be between 1 and 4096 bytes. #### Parameters ##### address [`Reference`](Reference.md) Address of the Content Addressed Chunk ##### span [`Span`](Span.md) Span of the Content Addressed Chunk ##### payload [`Bytes`](Bytes.md) Payload of the Content Addressed Chunk ##### identifier The identifier of the chunk `string` | `Uint8Array`\<`ArrayBufferLike`\> | [`Identifier`](Identifier.md) ##### signer The signer interface for signing the chunk `string` | `Uint8Array`\<`ArrayBufferLike`\> | [`PrivateKey`](PrivateKey.md) #### Returns [`SingleOwnerChunk`](../interfaces/SingleOwnerChunk.md) *** ### rchash() > **rchash**(`depth`, `anchor1`, `anchor2`, `requestOptions?`): `Promise`\<`number`\> Defined in: [bee-js/src/bee.ts:372](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/bee.ts#L372) Gets reserve commitment hash duration seconds. To be able to participe in the storage incentives and not get frozen, this should ideally run under 5 minutes. This is a CPU intensice operation, as roughly 2^22 chunks are hashed in the process. #### Parameters ##### depth `number` ##### anchor1 `string` ##### anchor2 `string` ##### requestOptions? [`BeeRequestOptions`](../type-aliases/BeeRequestOptions.md) Options for making requests, such as timeouts, custom HTTP agents, headers, etc. #### Returns `Promise`\<`number`\> #### Example ```ts const addresses = await bee.connectivity.getNodeAddresses() const topology = await bee.connectivity.getTopology() const result = await bee.rchash(topology.depth, addresses.overlay.toHex(), addresses.overlay.toHex()) // result is a number of seconds ``` *** ### unmarshalContentAddressedChunk() > **unmarshalContentAddressedChunk**(`data`): [`Chunk`](../interfaces/Chunk.md) Defined in: [bee-js/src/bee.ts:277](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/bee.ts#L277) Attempts to unmarshal arbitrary data into a Content Addressed Chunk. Throws an error if the data is not a valid CAC. #### Parameters ##### data The chunk data (`span` and `payload`) `Uint8Array`\<`ArrayBufferLike`\> | [`Bytes`](Bytes.md) #### Returns [`Chunk`](../interfaces/Chunk.md) *** ### unmarshalSingleOwnerChunk() > **unmarshalSingleOwnerChunk**(`data`, `address`): [`SingleOwnerChunk`](../interfaces/SingleOwnerChunk.md) Defined in: [bee-js/src/bee.ts:325](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/bee.ts#L325) Attempts to unmarshal arbitrary data into a Single Owner Chunk. Throws an error if the data is not a valid SOC. #### Parameters ##### data The chunk data `Uint8Array`\<`ArrayBufferLike`\> | [`Bytes`](Bytes.md) ##### address The address of the single owner chunk `string` | `Uint8Array`\<`ArrayBufferLike`\> | [`Reference`](Reference.md) #### Returns [`SingleOwnerChunk`](../interfaces/SingleOwnerChunk.md) a single owner chunk or throws error --- ## Class: BeeArgumentError Defined in: [bee-js/src/utils/error.ts:8](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/utils/error.ts#L8) ## Extends - [`BeeError`](BeeError.md) ## Constructors ### Constructor > **new BeeArgumentError**(`message`, `value`): `BeeArgumentError` Defined in: [bee-js/src/utils/error.ts:9](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/utils/error.ts#L9) #### Parameters ##### message `string` ##### value `unknown` #### Returns `BeeArgumentError` #### Overrides [`BeeError`](BeeError.md).[`constructor`](BeeError.md#constructor) ## Properties ### message > **message**: `string` Defined in: typescript/lib/lib.es5.d.ts:1077 #### Inherited from [`BeeError`](BeeError.md).[`message`](BeeError.md#message) *** ### name > **name**: `string` Defined in: typescript/lib/lib.es5.d.ts:1076 #### Inherited from [`BeeError`](BeeError.md).[`name`](BeeError.md#name) *** ### stack? > `optional` **stack**: `string` Defined in: typescript/lib/lib.es5.d.ts:1078 #### Inherited from [`BeeError`](BeeError.md).[`stack`](BeeError.md#stack) *** ### value > `readonly` **value**: `unknown` Defined in: [bee-js/src/utils/error.ts:11](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/utils/error.ts#L11) *** ### stackTraceLimit > `static` **stackTraceLimit**: `number` Defined in: bee-js/node\_modules/@types/node/globals.d.ts:67 The `Error.stackTraceLimit` property specifies the number of stack frames collected by a stack trace (whether generated by `new Error().stack` or `Error.captureStackTrace(obj)`). The default value is `10` but may be set to any valid JavaScript number. Changes will affect any stack trace captured _after_ the value has been changed. If set to a non-number value, or set to a negative number, stack traces will not capture any frames. #### Inherited from [`BeeError`](BeeError.md).[`stackTraceLimit`](BeeError.md#stacktracelimit) ## Methods ### captureStackTrace() > `static` **captureStackTrace**(`targetObject`, `constructorOpt?`): `void` Defined in: bee-js/node\_modules/@types/node/globals.d.ts:51 Creates a `.stack` property on `targetObject`, which when accessed returns a string representing the location in the code at which `Error.captureStackTrace()` was called. ```js const myObject = {}; Error.captureStackTrace(myObject); myObject.stack; // Similar to `new Error().stack` ``` The first line of the trace will be prefixed with `${myObject.name}: ${myObject.message}`. The optional `constructorOpt` argument accepts a function. If given, all frames above `constructorOpt`, including `constructorOpt`, will be omitted from the generated stack trace. The `constructorOpt` argument is useful for hiding implementation details of error generation from the user. For instance: ```js function a() { b(); } function b() { c(); } function c() { // Create an error without stack trace to avoid calculating the stack trace twice. const { stackTraceLimit } = Error; Error.stackTraceLimit = 0; const error = new Error(); Error.stackTraceLimit = stackTraceLimit; // Capture the stack trace above function b Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace throw error; } a(); ``` #### Parameters ##### targetObject `object` ##### constructorOpt? `Function` #### Returns `void` #### Inherited from [`BeeError`](BeeError.md).[`captureStackTrace`](BeeError.md#capturestacktrace) *** ### prepareStackTrace() > `static` **prepareStackTrace**(`err`, `stackTraces`): `any` Defined in: bee-js/node\_modules/@types/node/globals.d.ts:55 #### Parameters ##### err `Error` ##### stackTraces `CallSite`[] #### Returns `any` #### See https://v8.dev/docs/stack-trace-api#customizing-stack-traces #### Inherited from [`BeeError`](BeeError.md).[`prepareStackTrace`](BeeError.md#preparestacktrace) --- ## Class: BeeError Defined in: [bee-js/src/utils/error.ts:1](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/utils/error.ts#L1) ## Extends - `Error` ## Extended by - [`BeeArgumentError`](BeeArgumentError.md) - [`BeeResponseError`](BeeResponseError.md) ## Constructors ### Constructor > **new BeeError**(`message`): `BeeError` Defined in: [bee-js/src/utils/error.ts:2](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/utils/error.ts#L2) #### Parameters ##### message `string` #### Returns `BeeError` #### Overrides `Error.constructor` ## Properties ### message > **message**: `string` Defined in: typescript/lib/lib.es5.d.ts:1077 #### Inherited from `Error.message` *** ### name > **name**: `string` Defined in: typescript/lib/lib.es5.d.ts:1076 #### Inherited from `Error.name` *** ### stack? > `optional` **stack**: `string` Defined in: typescript/lib/lib.es5.d.ts:1078 #### Inherited from `Error.stack` *** ### stackTraceLimit > `static` **stackTraceLimit**: `number` Defined in: bee-js/node\_modules/@types/node/globals.d.ts:67 The `Error.stackTraceLimit` property specifies the number of stack frames collected by a stack trace (whether generated by `new Error().stack` or `Error.captureStackTrace(obj)`). The default value is `10` but may be set to any valid JavaScript number. Changes will affect any stack trace captured _after_ the value has been changed. If set to a non-number value, or set to a negative number, stack traces will not capture any frames. #### Inherited from `Error.stackTraceLimit` ## Methods ### captureStackTrace() > `static` **captureStackTrace**(`targetObject`, `constructorOpt?`): `void` Defined in: bee-js/node\_modules/@types/node/globals.d.ts:51 Creates a `.stack` property on `targetObject`, which when accessed returns a string representing the location in the code at which `Error.captureStackTrace()` was called. ```js const myObject = {}; Error.captureStackTrace(myObject); myObject.stack; // Similar to `new Error().stack` ``` The first line of the trace will be prefixed with `${myObject.name}: ${myObject.message}`. The optional `constructorOpt` argument accepts a function. If given, all frames above `constructorOpt`, including `constructorOpt`, will be omitted from the generated stack trace. The `constructorOpt` argument is useful for hiding implementation details of error generation from the user. For instance: ```js function a() { b(); } function b() { c(); } function c() { // Create an error without stack trace to avoid calculating the stack trace twice. const { stackTraceLimit } = Error; Error.stackTraceLimit = 0; const error = new Error(); Error.stackTraceLimit = stackTraceLimit; // Capture the stack trace above function b Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace throw error; } a(); ``` #### Parameters ##### targetObject `object` ##### constructorOpt? `Function` #### Returns `void` #### Inherited from `Error.captureStackTrace` *** ### prepareStackTrace() > `static` **prepareStackTrace**(`err`, `stackTraces`): `any` Defined in: bee-js/node\_modules/@types/node/globals.d.ts:55 #### Parameters ##### err `Error` ##### stackTraces `CallSite`[] #### Returns `any` #### See https://v8.dev/docs/stack-trace-api#customizing-stack-traces #### Inherited from `Error.prepareStackTrace` --- ## Class: BeeResponseError Defined in: [bee-js/src/utils/error.ts:18](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/utils/error.ts#L18) ## Extends - [`BeeError`](BeeError.md) ## Constructors ### Constructor > **new BeeResponseError**(`method`, `url`, `message`, `responseBody?`, `status?`, `statusText?`): `BeeResponseError` Defined in: [bee-js/src/utils/error.ts:21](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/utils/error.ts#L21) #### Parameters ##### method `string` ##### url `string` ##### message `string` ##### responseBody? `unknown` ##### status? `number` ##### statusText? `string` #### Returns `BeeResponseError` #### Overrides [`BeeError`](BeeError.md).[`constructor`](BeeError.md#constructor) ## Properties ### message > **message**: `string` Defined in: typescript/lib/lib.es5.d.ts:1077 #### Inherited from [`BeeError`](BeeError.md).[`message`](BeeError.md#message) *** ### method > **method**: `string` Defined in: [bee-js/src/utils/error.ts:22](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/utils/error.ts#L22) *** ### name > **name**: `string` Defined in: typescript/lib/lib.es5.d.ts:1076 #### Inherited from [`BeeError`](BeeError.md).[`name`](BeeError.md#name) *** ### response > `readonly` **response**: `object` Defined in: [bee-js/src/utils/error.ts:19](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/utils/error.ts#L19) #### data > **data**: `unknown` #### status > **status**: `number` \| `undefined` #### statusText > **statusText**: `string` \| `undefined` *** ### responseBody? > `optional` **responseBody**: `unknown` Defined in: [bee-js/src/utils/error.ts:25](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/utils/error.ts#L25) *** ### stack? > `optional` **stack**: `string` Defined in: typescript/lib/lib.es5.d.ts:1078 #### Inherited from [`BeeError`](BeeError.md).[`stack`](BeeError.md#stack) *** ### status? > `optional` **status**: `number` Defined in: [bee-js/src/utils/error.ts:26](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/utils/error.ts#L26) *** ### statusText? > `optional` **statusText**: `string` Defined in: [bee-js/src/utils/error.ts:27](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/utils/error.ts#L27) *** ### url > **url**: `string` Defined in: [bee-js/src/utils/error.ts:23](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/utils/error.ts#L23) *** ### stackTraceLimit > `static` **stackTraceLimit**: `number` Defined in: bee-js/node\_modules/@types/node/globals.d.ts:67 The `Error.stackTraceLimit` property specifies the number of stack frames collected by a stack trace (whether generated by `new Error().stack` or `Error.captureStackTrace(obj)`). The default value is `10` but may be set to any valid JavaScript number. Changes will affect any stack trace captured _after_ the value has been changed. If set to a non-number value, or set to a negative number, stack traces will not capture any frames. #### Inherited from [`BeeError`](BeeError.md).[`stackTraceLimit`](BeeError.md#stacktracelimit) ## Methods ### captureStackTrace() > `static` **captureStackTrace**(`targetObject`, `constructorOpt?`): `void` Defined in: bee-js/node\_modules/@types/node/globals.d.ts:51 Creates a `.stack` property on `targetObject`, which when accessed returns a string representing the location in the code at which `Error.captureStackTrace()` was called. ```js const myObject = {}; Error.captureStackTrace(myObject); myObject.stack; // Similar to `new Error().stack` ``` The first line of the trace will be prefixed with `${myObject.name}: ${myObject.message}`. The optional `constructorOpt` argument accepts a function. If given, all frames above `constructorOpt`, including `constructorOpt`, will be omitted from the generated stack trace. The `constructorOpt` argument is useful for hiding implementation details of error generation from the user. For instance: ```js function a() { b(); } function b() { c(); } function c() { // Create an error without stack trace to avoid calculating the stack trace twice. const { stackTraceLimit } = Error; Error.stackTraceLimit = 0; const error = new Error(); Error.stackTraceLimit = stackTraceLimit; // Capture the stack trace above function b Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace throw error; } a(); ``` #### Parameters ##### targetObject `object` ##### constructorOpt? `Function` #### Returns `void` #### Inherited from [`BeeError`](BeeError.md).[`captureStackTrace`](BeeError.md#capturestacktrace) *** ### prepareStackTrace() > `static` **prepareStackTrace**(`err`, `stackTraces`): `any` Defined in: bee-js/node\_modules/@types/node/globals.d.ts:55 #### Parameters ##### err `Error` ##### stackTraces `CallSite`[] #### Returns `any` #### See https://v8.dev/docs/stack-trace-api#customizing-stack-traces #### Inherited from [`BeeError`](BeeError.md).[`prepareStackTrace`](BeeError.md#preparestacktrace) --- ## Class: Bytes Defined in: [core-sdk/src/bytes/bytes.ts:17](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L17) Base wrapper around a byte array, accepting a Uint8Array, ArrayBuffer, hex string, or another Bytes instance, with an optional length check. ## Extended by - [`BatchId`](BatchId.md) - [`EthAddress`](EthAddress.md) - [`FeedIndex`](FeedIndex.md) - [`Identifier`](Identifier.md) - [`PeerAddress`](PeerAddress.md) - [`PrivateKey`](PrivateKey.md) - [`PublicKey`](PublicKey.md) - [`Reference`](Reference.md) - [`Signature`](Signature.md) - [`Span`](Span.md) - [`Topic`](Topic.md) - [`TransactionId`](TransactionId.md) ## Constructors ### Constructor > **new Bytes**(`bytes`, `byteLength?`): `Bytes` Defined in: [core-sdk/src/bytes/bytes.ts:25](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L25) #### Parameters ##### bytes `string` | `ArrayBuffer` | `Uint8Array`\<`ArrayBufferLike`\> | `Bytes` ##### byteLength? If given, throws unless the resulting length matches (or, for an array, is one of) the expected length(s). `number` | `number`[] #### Returns `Bytes` ## Properties ### length > `readonly` **length**: `number` Defined in: [core-sdk/src/bytes/bytes.ts:19](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L19) ## Methods ### equals() > **equals**(`other`): `boolean` Defined in: [core-sdk/src/bytes/bytes.ts:173](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L173) Byte-wise equality against another Bytes instance, raw bytes, or hex string. #### Parameters ##### other `string` | `Uint8Array`\<`ArrayBufferLike`\> | `Bytes` #### Returns `boolean` *** ### offset() > **offset**(`index`): `Uint8Array` Defined in: [core-sdk/src/bytes/bytes.ts:110](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L110) Returns a copy of the bytes from `index` to the end. #### Parameters ##### index `number` #### Returns `Uint8Array` *** ### parsePayloadAsJson() > **parsePayloadAsJson**(): `unknown` Defined in: [core-sdk/src/bytes/bytes.ts:159](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L159) Parses the bytes as UTF-8 JSON. #### Returns `unknown` *** ### represent() > **represent**(): `string` Defined in: [core-sdk/src/bytes/bytes.ts:180](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L180) Human-readable representation, used by debuggers/loggers. Same as [toHex](#tohex). #### Returns `string` *** ### toBase32() > **toBase32**(): `string` Defined in: [core-sdk/src/bytes/bytes.ts:138](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L138) Encodes as a padded base32 string. #### Returns `string` *** ### toBase64() > **toBase64**(): `string` Defined in: [core-sdk/src/bytes/bytes.ts:131](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L131) Encodes as a padded base64 string. #### Returns `string` *** ### toHex() > **toHex**(): `string` Defined in: [core-sdk/src/bytes/bytes.ts:124](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L124) Encodes as a lowercase hex string, with no `0x` prefix. #### Returns `string` *** ### toJSON() > **toJSON**(): `string` Defined in: [core-sdk/src/bytes/bytes.ts:166](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L166) Serialized as its hex string by `JSON.stringify`. #### Returns `string` *** ### toString() > **toString**(): `string` Defined in: [core-sdk/src/bytes/bytes.ts:145](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L145) Same as [toHex](#tohex). #### Returns `string` *** ### toUint8Array() > **toUint8Array**(): `Uint8Array` Defined in: [core-sdk/src/bytes/bytes.ts:117](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L117) Returns a copy of the underlying bytes. #### Returns `Uint8Array` *** ### toUtf8() > **toUtf8**(): `string` Defined in: [core-sdk/src/bytes/bytes.ts:152](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L152) Decodes the bytes as UTF-8 text. #### Returns `string` *** ### concat() > `static` **concat**(...`arrays`): `Uint8Array` Defined in: [core-sdk/src/bytes/bytes.ts:75](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L75) Concatenates any number of byte arrays (or Bytes instances) into one new array. #### Parameters ##### arrays ...(`Uint8Array`\<`ArrayBufferLike`\> \| `Bytes`)[] #### Returns `Uint8Array` *** ### fromSlice() > `static` **fromSlice**(`bytes`, `start`, `length?`): `Bytes` Defined in: [core-sdk/src/bytes/bytes.ts:100](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L100) Wraps a slice of `bytes` starting at `start`, running to the end unless `length` is given. #### Parameters ##### bytes `Uint8Array` ##### start `number` ##### length? `number` #### Returns `Bytes` *** ### fromUtf8() > `static` **fromUtf8**(`utf8`): `Bytes` Defined in: [core-sdk/src/bytes/bytes.ts:92](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L92) Wraps the UTF-8 encoding of a string. #### Parameters ##### utf8 `string` #### Returns `Bytes` *** ### keccak256() > `static` **keccak256**(`bytes`): `Bytes` Defined in: [core-sdk/src/bytes/bytes.ts:68](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L68) Hashes `bytes` with keccak256 and wraps the 32-byte digest. #### Parameters ##### bytes `string` | `ArrayBuffer` | `Uint8Array`\<`ArrayBufferLike`\> | `Bytes` #### Returns `Bytes` --- ## Class: Cheque Defined in: [bee-js/src/modules/cheque.ts:18](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/modules/cheque.ts#L18) Cheque operations (last cheques and cashouts). Accessed as `bee.cheque`. ## Constructors ### Constructor > **new Cheque**(`context`): `Cheque` Defined in: [bee-js/src/modules/cheque.ts:19](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/modules/cheque.ts#L19) #### Parameters ##### context `BeeContext` #### Returns `Cheque` ## Methods ### cashoutLast() > **cashoutLast**(`address`, `options?`, `requestOptions?`): `Promise`\<[`TransactionId`](../classes/TransactionId.md)\> Defined in: [bee-js/src/modules/cheque.ts:67](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/modules/cheque.ts#L67) Cashes out the last cheque for a specific peer. #### Parameters ##### address Swarm address of peer `string` | [`PeerAddress`](../classes/PeerAddress.md) ##### options? [`TransactionOptions`](../interfaces/TransactionOptions.md) ##### requestOptions? [`BeeRequestOptions`](../type-aliases/BeeRequestOptions.md) Options for making requests, such as timeouts, custom HTTP agents, headers, etc. #### Returns `Promise`\<[`TransactionId`](../classes/TransactionId.md)\> *** ### getAllLatest() > **getAllLatest**(`requestOptions?`): `Promise`\<[`LastChequesResponse`](../interfaces/LastChequesResponse.md)\> Defined in: [bee-js/src/modules/cheque.ts:26](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/modules/cheque.ts#L26) Gets the last cheques for all peers. #### Parameters ##### requestOptions? [`BeeRequestOptions`](../type-aliases/BeeRequestOptions.md) Options for making requests, such as timeouts, custom HTTP agents, headers, etc. #### Returns `Promise`\<[`LastChequesResponse`](../interfaces/LastChequesResponse.md)\> *** ### getAllLatestForPeer() > **getAllLatestForPeer**(`address`, `requestOptions?`): `Promise`\<[`LastChequesForPeerResponse`](../interfaces/LastChequesForPeerResponse.md)\> Defined in: [bee-js/src/modules/cheque.ts:36](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/modules/cheque.ts#L36) Gets the last cheques for a specific peer. #### Parameters ##### address Overlay address of peer. `string` | [`PeerAddress`](../classes/PeerAddress.md) ##### requestOptions? [`BeeRequestOptions`](../type-aliases/BeeRequestOptions.md) Options for making requests, such as timeouts, custom HTTP agents, headers, etc. #### Returns `Promise`\<[`LastChequesForPeerResponse`](../interfaces/LastChequesForPeerResponse.md)\> *** ### getLastCashoutAction() > **getLastCashoutAction**(`address`, `requestOptions?`): `Promise`\<[`LastCashoutActionResponse`](../interfaces/LastCashoutActionResponse.md)\> Defined in: [bee-js/src/modules/cheque.ts:51](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/modules/cheque.ts#L51) Gets the last cashout action for a specific peer. #### Parameters ##### address Overlay address of peer. `string` | [`PeerAddress`](../classes/PeerAddress.md) ##### requestOptions? [`BeeRequestOptions`](../type-aliases/BeeRequestOptions.md) Options for making requests, such as timeouts, custom HTTP agents, headers, etc. #### Returns `Promise`\<[`LastCashoutActionResponse`](../interfaces/LastCashoutActionResponse.md)\> --- ## Class: Chequebook Defined in: [bee-js/src/modules/chequebook.ts:13](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/modules/chequebook.ts#L13) Chequebook contract operations (address, balance, deposit, withdraw). Accessed as `bee.chequebook`. ## Constructors ### Constructor > **new Chequebook**(`context`): `Chequebook` Defined in: [bee-js/src/modules/chequebook.ts:14](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/modules/chequebook.ts#L14) #### Parameters ##### context `BeeContext` #### Returns `Chequebook` ## Methods ### deposit() > **deposit**(`amount`, `gasPrice?`, `requestOptions?`): `Promise`\<[`TransactionId`](../classes/TransactionId.md)\> Defined in: [bee-js/src/modules/chequebook.ts:41](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/modules/chequebook.ts#L41) Deposits tokens from the node wallet into the chequebook. #### Parameters ##### amount Amount of BZZ tokens to deposit. If not providing a `BZZ` instance, the amount is denoted in PLUR. `string` | `bigint` | [`NumberString`](../type-aliases/NumberString.md) | [`BZZ`](../classes/BZZ.md) ##### gasPrice? Gas Price in WEI for the transaction call `string` | `bigint` | [`NumberString`](../type-aliases/NumberString.md) ##### requestOptions? [`BeeRequestOptions`](../type-aliases/BeeRequestOptions.md) Options for making requests, such as timeouts, custom HTTP agents, headers, etc. #### Returns `Promise`\<[`TransactionId`](../classes/TransactionId.md)\> *** ### getAddress() > **getAddress**(`requestOptions?`): `Promise`\<[`ChequebookAddressResponse`](../interfaces/ChequebookAddressResponse.md)\> Defined in: [bee-js/src/modules/chequebook.ts:21](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/modules/chequebook.ts#L21) Gets the address of the deployed chequebook. #### Parameters ##### requestOptions? [`BeeRequestOptions`](../type-aliases/BeeRequestOptions.md) Options for making requests, such as timeouts, custom HTTP agents, headers, etc. #### Returns `Promise`\<[`ChequebookAddressResponse`](../interfaces/ChequebookAddressResponse.md)\> *** ### getBalance() > **getBalance**(`requestOptions?`): `Promise`\<[`ChequebookBalanceResponse`](../interfaces/ChequebookBalanceResponse.md)\> Defined in: [bee-js/src/modules/chequebook.ts:30](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/modules/chequebook.ts#L30) Gets the balance of the chequebook. #### Parameters ##### requestOptions? [`BeeRequestOptions`](../type-aliases/BeeRequestOptions.md) Options for making requests, such as timeouts, custom HTTP agents, headers, etc. #### Returns `Promise`\<[`ChequebookBalanceResponse`](../interfaces/ChequebookBalanceResponse.md)\> *** ### withdraw() > **withdraw**(`amount`, `gasPrice?`, `requestOptions?`): `Promise`\<[`TransactionId`](../classes/TransactionId.md)\> Defined in: [bee-js/src/modules/chequebook.ts:61](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/modules/chequebook.ts#L61) Withdraws tokens from the chequebook to the node wallet. #### Parameters ##### amount Amount of BZZ tokens to withdraw. If not providing a `BZZ` instance, the amount is denoted in PLUR. `string` | `bigint` | [`NumberString`](../type-aliases/NumberString.md) | [`BZZ`](../classes/BZZ.md) ##### gasPrice? Gas Price in WEI for the transaction call. `string` | `bigint` | [`NumberString`](../type-aliases/NumberString.md) ##### requestOptions? [`BeeRequestOptions`](../type-aliases/BeeRequestOptions.md) Options for making requests, such as timeouts, custom HTTP agents, headers, etc. #### Returns `Promise`\<[`TransactionId`](../classes/TransactionId.md)\> --- ## Class: Chunk Defined in: [bee-js/src/modules/chunk.ts:15](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/modules/chunk.ts#L15) Chunk operations backed by the `/chunks` endpoint. Accessed as `bee.chunk`. ## Constructors ### Constructor > **new Chunk**(`context`): `Chunk` Defined in: [bee-js/src/modules/chunk.ts:16](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/modules/chunk.ts#L16) #### Parameters ##### context `BeeContext` #### Returns `Chunk` ## Methods ### download() > **download**(`reference`, `options?`, `requestOptions?`): `Promise`\<`Uint8Array`\<`ArrayBufferLike`\>\> Defined in: [bee-js/src/modules/chunk.ts:67](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/modules/chunk.ts#L67) Downloads a chunk as a `Uint8Array`. #### Parameters ##### reference Bee chunk reference in hex string (either 64 or 128 chars long) or ENS domain. `string` | `Uint8Array`\<`ArrayBufferLike`\> | [`Reference`](../classes/Reference.md) ##### options? [`DownloadOptions`](../interfaces/DownloadOptions.md) Options that affects the request behavior ##### requestOptions? [`BeeRequestOptions`](../type-aliases/BeeRequestOptions.md) Options for making requests, such as timeouts, custom HTTP agents, headers, etc. #### Returns `Promise`\<`Uint8Array`\<`ArrayBufferLike`\>\> *** ### upload() > **upload**(`stamp`, `data`, `options?`, `requestOptions?`): `Promise`\<[`UploadResult`](../interfaces/UploadResult.md)\> Defined in: [bee-js/src/modules/chunk.ts:28](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/modules/chunk.ts#L28) Uploads a chunk to the network. Chunks uploaded with this method should be retrieved with [download](#download). #### Parameters ##### stamp Postage Batch ID or an Envelope created with the `bee.createEnvelope` method. `string` | `Uint8Array`\<`ArrayBufferLike`\> | [`BatchId`](../classes/BatchId.md) | [`EnvelopeWithBatchId`](../interfaces/EnvelopeWithBatchId.md) ##### data Raw chunk to be uploaded (Content Addressed Chunk or Single Owner Chunk) `Uint8Array`\<`ArrayBufferLike`\> | [`Chunk`](../interfaces/Chunk.md) | [`SingleOwnerChunk`](../interfaces/SingleOwnerChunk.md) ##### options? [`ChunkUploadOptions`](../interfaces/ChunkUploadOptions.md) Additional options like tag, encryption, pinning, content-type and request options ##### requestOptions? [`BeeRequestOptions`](../type-aliases/BeeRequestOptions.md) Options for making requests, such as timeouts, custom HTTP agents, headers, etc. #### Returns `Promise`\<[`UploadResult`](../interfaces/UploadResult.md)\> --- ## Class: ChunkBuilder Defined in: [core-sdk/src/chunk/splitter.ts:16](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/chunk/splitter.ts#L16) A chunk (up to 4096 bytes of payload) being filled in by a ChunkSplitter, before it's sealed. Unlike the immutable CAC [Chunk](../interfaces/Chunk.md), this is a mutable buffer - only `hash()`/`encryptedHash()`/`build()` finalize it. ## Constructors ### Constructor > **new ChunkBuilder**(`span?`): `ChunkBuilder` Defined in: [core-sdk/src/chunk/splitter.ts:20](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/chunk/splitter.ts#L20) #### Parameters ##### span? `bigint` #### Returns `ChunkBuilder` ## Properties ### span > **span**: `bigint` Defined in: [core-sdk/src/chunk/splitter.ts:17](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/chunk/splitter.ts#L17) *** ### writer > **writer**: `Uint8ArrayWriter` Defined in: [core-sdk/src/chunk/splitter.ts:18](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/chunk/splitter.ts#L18) ## Methods ### build() > **build**(): `Uint8Array` Defined in: [core-sdk/src/chunk/splitter.ts:28](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/chunk/splitter.ts#L28) Returns the raw chunk bytes: 8-byte span || 4096-byte payload buffer. #### Returns `Uint8Array` *** ### encryptedHash() > **encryptedHash**(`key?`): `object` Defined in: [core-sdk/src/chunk/splitter.ts:43](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/chunk/splitter.ts#L43) Encrypts this chunk with `key` (generating a random one if omitted) and returns the resulting address alongside the key used. #### Parameters ##### key? `Uint8Array`\<`ArrayBufferLike`\> #### Returns `object` ##### address > **address**: [`Reference`](Reference.md) ##### key > **key**: `Uint8Array` *** ### hash() > **hash**(): [`Reference`](Reference.md) Defined in: [core-sdk/src/chunk/splitter.ts:35](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/chunk/splitter.ts#L35) Computes the unencrypted BMT address of this chunk. #### Returns [`Reference`](Reference.md) --- ## Class: ChunkSplitter Defined in: [core-sdk/src/chunk/splitter.ts:66](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/chunk/splitter.ts#L66) Splits arbitrary data into a tree of 4096-byte chunks (the inverse of ChunkJoiner), calling `onBatch` with each level's sealed chunks as they fill up - e.g. to upload them, or (via erasure-coding/batch.ts) to add Reed-Solomon parity chunks. ## Constructors ### Constructor > **new ChunkSplitter**(`onBatch`, `maxShards?`, `encrypted?`, `onIntermediateChunk?`): `ChunkSplitter` Defined in: [core-sdk/src/chunk/splitter.ts:90](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/chunk/splitter.ts#L90) #### Parameters ##### onBatch (`batch`) => `Promise`\<`ChunkEntry`[]\> Called with each level's sealed chunks as a batch fills up; return any parity entries to append as extra references (empty array for no redundancy). ##### maxShards? `number` Max data-chunk references per intermediate node. Defaults to as many as fit in one 4096-byte node; pass a smaller value (e.g. via erasure-coding's getMaxShards) to leave room for parity refs. ##### encrypted? `boolean` ##### onIntermediateChunk? (`chunk`, `hasParity`) => `void` Called with each intermediate chunk as it's sealed, so callers can tag it (e.g. encoding a redundancy level into its span). #### Returns `ChunkSplitter` ## Properties ### NOOP() > `readonly` `static` **NOOP**: (`_`) => `Promise`\<`ChunkEntry`[]\> Defined in: [core-sdk/src/chunk/splitter.ts:67](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/chunk/splitter.ts#L67) #### Parameters ##### \_ `ChunkEntry`[] #### Returns `Promise`\<`ChunkEntry`[]\> ## Methods ### append() > **append**(`data`, `level?`, `spanIncrement?`): `Promise`\<`void`\> Defined in: [core-sdk/src/chunk/splitter.ts:132](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/chunk/splitter.ts#L132) Appends more data to the tree, sealing and elevating chunks as needed. `level`/`spanIncrement` are internal - callers building a tree from raw input data should always call this at the default level 0. #### Parameters ##### data `Uint8Array` ##### level? `number` ##### spanIncrement? `bigint` #### Returns `Promise`\<`void`\> *** ### finalize() > **finalize**(`level?`): `Promise`\<[`ChunkBuilder`](ChunkBuilder.md)\> Defined in: [core-sdk/src/chunk/splitter.ts:217](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/chunk/splitter.ts#L217) Seals every level and returns the tree's root chunk. `level` is internal - callers should always start at the default level 0. #### Parameters ##### level? `number` #### Returns `Promise`\<[`ChunkBuilder`](ChunkBuilder.md)\> *** ### encryptedRoot() > `static` **encryptedRoot**(`data`): `Promise`\<\{ `address`: [`Reference`](Reference.md); `key`: `Uint8Array`; \}\> Defined in: [core-sdk/src/chunk/splitter.ts:119](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/chunk/splitter.ts#L119) Splits `data` into an encrypted chunk tree (no upload callback) and returns the root's encrypted address and key. #### Parameters ##### data `Uint8Array` #### Returns `Promise`\<\{ `address`: [`Reference`](Reference.md); `key`: `Uint8Array`; \}\> *** ### root() > `static` **root**(`data`): `Promise`\<[`ChunkBuilder`](ChunkBuilder.md)\> Defined in: [core-sdk/src/chunk/splitter.ts:108](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/chunk/splitter.ts#L108) Splits `data` into a chunk tree (no redundancy, no encryption, no upload callback) and returns just its root chunk. #### Parameters ##### data `Uint8Array` #### Returns `Promise`\<[`ChunkBuilder`](ChunkBuilder.md)\> --- ## Class: Collection Defined in: [bee-js/src/modules/collection.ts:21](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/modules/collection.ts#L21) Collection (multi-file) operations backed by the `/bzz` endpoint. Accessed as `bee.collection`. ## Constructors ### Constructor > **new Collection**(`context`): `Collection` Defined in: [bee-js/src/modules/collection.ts:22](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/modules/collection.ts#L22) #### Parameters ##### context `BeeContext` #### Returns `Collection` ## Methods ### hashDirectory() > **hashDirectory**(`dir`): `Promise`\<[`Reference`](../classes/Reference.md)\> Defined in: [bee-js/src/modules/collection.ts:169](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/modules/collection.ts#L169) Hashes a directory locally and returns the root hash (Swarm reference). The actual Swarm reference may be different as there is no canonical hashing of directories. #### Parameters ##### dir `string` #### Returns `Promise`\<[`Reference`](../classes/Reference.md)\> *** ### stream() > **stream**(`postageBatchId`, `files`, `onUploadProgress?`, `options?`, `requestOptions?`): `Promise`\<[`UploadResult`](../interfaces/UploadResult.md)\> Defined in: [bee-js/src/modules/collection.ts:112](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/modules/collection.ts#L112) Uploads a collection of files by streaming them to the Bee node, which supports arbitrary sizes, but may be slower due to uploading chunks one by one. Only intended for the browser environment. #### Parameters ##### postageBatchId `string` | `Uint8Array`\<`ArrayBufferLike`\> | [`BatchId`](../classes/BatchId.md) ##### files `File`[] | `FileList` ##### onUploadProgress? (`progress`) => `void` ##### options? [`UploadOptions`](../interfaces/UploadOptions.md) ##### requestOptions? [`BeeRequestOptions`](../type-aliases/BeeRequestOptions.md) Options for making requests, such as timeouts, custom HTTP agents, headers, etc. #### Returns `Promise`\<[`UploadResult`](../interfaces/UploadResult.md)\> *** ### streamFromDirectory() > **streamFromDirectory**(`postageBatchId`, `dir`, `onUploadProgress?`, `options?`, `requestOptions?`): `Promise`\<[`UploadResult`](../interfaces/UploadResult.md)\> Defined in: [bee-js/src/modules/collection.ts:143](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/modules/collection.ts#L143) Uploads a directory by streaming its contents directly to the Bee node, which supports arbitrary directory sizes, but may be slower due to uploading chunks one by one. Only intended for the Node.js environment. #### Parameters ##### postageBatchId `string` | `Uint8Array`\<`ArrayBufferLike`\> | [`BatchId`](../classes/BatchId.md) ##### dir `string` ##### onUploadProgress? (`progress`) => `void` ##### options? [`CollectionUploadOptions`](../interfaces/CollectionUploadOptions.md) ##### requestOptions? [`BeeRequestOptions`](../type-aliases/BeeRequestOptions.md) Options for making requests, such as timeouts, custom HTTP agents, headers, etc. #### Returns `Promise`\<[`UploadResult`](../interfaces/UploadResult.md)\> *** ### upload() > **upload**(`postageBatchId`, `collection`, `options?`, `requestOptions?`): `Promise`\<[`UploadResult`](../interfaces/UploadResult.md)\> Defined in: [bee-js/src/modules/collection.ts:32](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/modules/collection.ts#L32) Uploads a collection that you assemble yourself. #### Parameters ##### postageBatchId `string` | `Uint8Array`\<`ArrayBufferLike`\> | [`BatchId`](../classes/BatchId.md) ##### collection [`Collection`](../type-aliases/Collection.md) ##### options? [`CollectionUploadOptions`](../interfaces/CollectionUploadOptions.md) Collection and request options ##### requestOptions? [`BeeRequestOptions`](../type-aliases/BeeRequestOptions.md) Options for making requests, such as timeouts, custom HTTP agents, headers, etc. #### Returns `Promise`\<[`UploadResult`](../interfaces/UploadResult.md)\> *** ### uploadFromDirectory() > **uploadFromDirectory**(`postageBatchId`, `dir`, `options?`, `requestOptions?`): `Promise`\<[`UploadResult`](../interfaces/UploadResult.md)\> Defined in: [bee-js/src/modules/collection.ts:83](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/modules/collection.ts#L83) Uploads a collection of files from a directory on the filesystem. Available only in Node.js as it uses the `fs` module. #### Parameters ##### postageBatchId Postage BatchId to be used to upload the data with `string` | `Uint8Array`\<`ArrayBufferLike`\> | [`BatchId`](../classes/BatchId.md) ##### dir `string` the path of the files to be uploaded ##### options? [`CollectionUploadOptions`](../interfaces/CollectionUploadOptions.md) Additional options like tag, encryption, pinning and request options ##### requestOptions? [`BeeRequestOptions`](../type-aliases/BeeRequestOptions.md) Options for making requests, such as timeouts, custom HTTP agents, headers, etc. #### Returns `Promise`\<[`UploadResult`](../interfaces/UploadResult.md)\> *** ### uploadFromFileList() > **uploadFromFileList**(`postageBatchId`, `fileList`, `options?`, `requestOptions?`): `Promise`\<[`UploadResult`](../interfaces/UploadResult.md)\> Defined in: [bee-js/src/modules/collection.ts:56](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/modules/collection.ts#L56) Uploads a collection of files using the browser `FileList` API. #### Parameters ##### postageBatchId Postage BatchId to be used to upload the data with `string` | `Uint8Array`\<`ArrayBufferLike`\> | [`BatchId`](../classes/BatchId.md) ##### fileList list of files to be uploaded `File`[] | `FileList` ##### options? [`CollectionUploadOptions`](../interfaces/CollectionUploadOptions.md) Additional options like tag, encryption, pinning and request options ##### requestOptions? [`BeeRequestOptions`](../type-aliases/BeeRequestOptions.md) Options for making requests, such as timeouts, custom HTTP agents, headers, etc. #### Returns `Promise`\<[`UploadResult`](../interfaces/UploadResult.md)\> --- ## Class: Connectivity Defined in: [bee-js/src/modules/connectivity.ts:12](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/modules/connectivity.ts#L12) Peer, topology and network connectivity operations. Accessed as `bee.connectivity`. ## Constructors ### Constructor > **new Connectivity**(`context`): `Connectivity` Defined in: [bee-js/src/modules/connectivity.ts:13](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/modules/connectivity.ts#L13) #### Parameters ##### context `BeeContext` #### Returns `Connectivity` ## Methods ### checkConnection() > **checkConnection**(`requestOptions?`): `Promise`\<`void`\> Defined in: [bee-js/src/modules/connectivity.ts:21](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/modules/connectivity.ts#L21) Pings the Bee node to see if there is a live Bee node on the given URL. #### Parameters ##### requestOptions? [`BeeRequestOptions`](../type-aliases/BeeRequestOptions.md) Options for making requests, such as timeouts, custom HTTP agents, headers, etc. #### Returns `Promise`\<`void`\> #### Throws If connection was not successful throw error *** ### getBlocklist() > **getBlocklist**(`requestOptions?`): `Promise`\<[`Peer`](../interfaces/Peer.md)[]\> Defined in: [bee-js/src/modules/connectivity.ts:71](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/modules/connectivity.ts#L71) Fetches the list of blocked peers for this node. #### Parameters ##### requestOptions? [`BeeRequestOptions`](../type-aliases/BeeRequestOptions.md) Options for making requests, such as timeouts, custom HTTP agents, headers, etc. #### Returns `Promise`\<[`Peer`](../interfaces/Peer.md)[]\> *** ### getNodeAddresses() > **getNodeAddresses**(`requestOptions?`): `Promise`\<[`NodeAddresses`](../interfaces/NodeAddresses.md)\> Defined in: [bee-js/src/modules/connectivity.ts:62](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/modules/connectivity.ts#L62) Fetches the overlay, underlay, Ethereum, and other addresses of the Bee node. #### Parameters ##### requestOptions? [`BeeRequestOptions`](../type-aliases/BeeRequestOptions.md) Options for making requests, such as timeouts, custom HTTP agents, headers, etc. #### Returns `Promise`\<[`NodeAddresses`](../interfaces/NodeAddresses.md)\> *** ### getPeers() > **getPeers**(`requestOptions?`): `Promise`\<[`Peer`](../interfaces/Peer.md)[]\> Defined in: [bee-js/src/modules/connectivity.ts:80](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/modules/connectivity.ts#L80) Gets list of peers for this node. #### Parameters ##### requestOptions? [`BeeRequestOptions`](../type-aliases/BeeRequestOptions.md) Options for making requests, such as timeouts, custom HTTP agents, headers, etc. #### Returns `Promise`\<[`Peer`](../interfaces/Peer.md)[]\> *** ### getTopology() > **getTopology**(`requestOptions?`): `Promise`\<[`Topology`](../interfaces/Topology.md)\> Defined in: [bee-js/src/modules/connectivity.ts:101](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/modules/connectivity.ts#L101) Fetches topology and connectivity information of the Bee node. #### Parameters ##### requestOptions? [`BeeRequestOptions`](../type-aliases/BeeRequestOptions.md) Options for making requests, such as timeouts, custom HTTP agents, headers, etc. #### Returns `Promise`\<[`Topology`](../interfaces/Topology.md)\> *** ### isConnected() > **isConnected**(`requestOptions?`): `Promise`\<`boolean`\> Defined in: [bee-js/src/modules/connectivity.ts:31](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/modules/connectivity.ts#L31) Pings the Bee node to see if there is a live Bee node on the given URL. #### Parameters ##### requestOptions? [`BeeRequestOptions`](../type-aliases/BeeRequestOptions.md) Options for making requests, such as timeouts, custom HTTP agents, headers, etc. #### Returns `Promise`\<`boolean`\> true if successful, false on error *** ### isGateway() > **isGateway**(`requestOptions?`): `Promise`\<`boolean`\> Defined in: [bee-js/src/modules/connectivity.ts:49](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/modules/connectivity.ts#L49) Checks the `/gateway` endpoint to see if the remote API is a gateway. Do note that this is not a standard way to check for gateway nodes, but some of the gateway tooling expose this endpoint. #### Parameters ##### requestOptions? [`BeeRequestOptions`](../type-aliases/BeeRequestOptions.md) Options for making requests, such as timeouts, custom HTTP agents, headers, etc. #### Returns `Promise`\<`boolean`\> *** ### ping() > **ping**(`peer`, `requestOptions?`): `Promise`\<[`PingResponse`](../interfaces/PingResponse.md)\> Defined in: [bee-js/src/modules/connectivity.ts:111](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/modules/connectivity.ts#L111) Pings a specific peer to check its availability. #### Parameters ##### peer Overlay address of the peer to be pinged. `string` | [`PeerAddress`](../classes/PeerAddress.md) ##### requestOptions? [`BeeRequestOptions`](../type-aliases/BeeRequestOptions.md) Options for making requests, such as timeouts, custom HTTP agents, headers, etc. #### Returns `Promise`\<[`PingResponse`](../interfaces/PingResponse.md)\> *** ### removePeer() > **removePeer**(`peer`, `requestOptions?`): `Promise`\<[`RemovePeerResponse`](../interfaces/RemovePeerResponse.md)\> Defined in: [bee-js/src/modules/connectivity.ts:90](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/modules/connectivity.ts#L90) Disconnects from a specific peer. #### Parameters ##### peer Overlay address of the peer to be removed. `string` | [`PeerAddress`](../classes/PeerAddress.md) ##### requestOptions? [`BeeRequestOptions`](../type-aliases/BeeRequestOptions.md) Options for making requests, such as timeouts, custom HTTP agents, headers, etc. #### Returns `Promise`\<[`RemovePeerResponse`](../interfaces/RemovePeerResponse.md)\> --- ## Class: DAI Defined in: [bee-js/src/utils/tokens.ts:102](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/utils/tokens.ts#L102) ## Properties ### DIGITS > `readonly` `static` **DIGITS**: `18` = `18` Defined in: [bee-js/src/utils/tokens.ts:103](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/utils/tokens.ts#L103) ## Methods ### divide() > **divide**(`other`): `DAI` Defined in: [bee-js/src/utils/tokens.ts:169](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/utils/tokens.ts#L169) Does not mutate the current DAI instance. #### Parameters ##### other `bigint` Divisor #### Returns `DAI` New DAI instance *** ### eq() > **eq**(`other`): `boolean` Defined in: [bee-js/src/utils/tokens.ts:189](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/utils/tokens.ts#L189) #### Parameters ##### other `DAI` #### Returns `boolean` *** ### exchangeToBZZ() > **exchangeToBZZ**(`daiPerBzz`): [`BZZ`](BZZ.md) Defined in: [bee-js/src/utils/tokens.ts:193](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/utils/tokens.ts#L193) #### Parameters ##### daiPerBzz `DAI` #### Returns [`BZZ`](BZZ.md) *** ### gt() > **gt**(`other`): `boolean` Defined in: [bee-js/src/utils/tokens.ts:173](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/utils/tokens.ts#L173) #### Parameters ##### other `DAI` #### Returns `boolean` *** ### gte() > **gte**(`other`): `boolean` Defined in: [bee-js/src/utils/tokens.ts:177](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/utils/tokens.ts#L177) #### Parameters ##### other `DAI` #### Returns `boolean` *** ### lt() > **lt**(`other`): `boolean` Defined in: [bee-js/src/utils/tokens.ts:181](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/utils/tokens.ts#L181) #### Parameters ##### other `DAI` #### Returns `boolean` *** ### lte() > **lte**(`other`): `boolean` Defined in: [bee-js/src/utils/tokens.ts:185](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/utils/tokens.ts#L185) #### Parameters ##### other `DAI` #### Returns `boolean` *** ### minus() > **minus**(`other`): `DAI` Defined in: [bee-js/src/utils/tokens.ts:159](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/utils/tokens.ts#L159) Does not mutate the current DAI instance. #### Parameters ##### other DAI instance, or amount in PLUR `string` | `bigint` | [`NumberString`](../type-aliases/NumberString.md) | `DAI` #### Returns `DAI` New DAI instance *** ### plus() > **plus**(`other`): `DAI` Defined in: [bee-js/src/utils/tokens.ts:149](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/utils/tokens.ts#L149) Does not mutate the current DAI instance. #### Parameters ##### other DAI instance, or amount in PLUR `string` | `bigint` | [`NumberString`](../type-aliases/NumberString.md) | `DAI` #### Returns `DAI` New DAI instance *** ### toDecimalString() > **toDecimalString**(): `string` Defined in: [bee-js/src/utils/tokens.ts:131](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/utils/tokens.ts#L131) #### Returns `string` *** ### toFloat() > **toFloat**(): `number` Defined in: [bee-js/src/utils/tokens.ts:139](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/utils/tokens.ts#L139) #### Returns `number` *** ### toSignificantDigits() > **toSignificantDigits**(`digits`): `string` Defined in: [bee-js/src/utils/tokens.ts:135](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/utils/tokens.ts#L135) #### Parameters ##### digits `number` #### Returns `string` *** ### toWeiBigInt() > **toWeiBigInt**(): `bigint` Defined in: [bee-js/src/utils/tokens.ts:127](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/utils/tokens.ts#L127) #### Returns `bigint` *** ### toWeiString() > **toWeiString**(): `string` Defined in: [bee-js/src/utils/tokens.ts:123](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/utils/tokens.ts#L123) #### Returns `string` *** ### fromDecimalString() > `static` **fromDecimalString**(`string`): `DAI` Defined in: [bee-js/src/utils/tokens.ts:111](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/utils/tokens.ts#L111) #### Parameters ##### string `string` #### Returns `DAI` *** ### fromFloat() > `static` **fromFloat**(`float`): `DAI` Defined in: [bee-js/src/utils/tokens.ts:119](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/utils/tokens.ts#L119) #### Parameters ##### float `number` #### Returns `DAI` *** ### fromWei() > `static` **fromWei**(`wei`): `DAI` Defined in: [bee-js/src/utils/tokens.ts:115](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/utils/tokens.ts#L115) #### Parameters ##### wei `string` | `bigint` | [`NumberString`](../type-aliases/NumberString.md) #### Returns `DAI` --- ## Class: Data Defined in: [bee-js/src/modules/data.ts:22](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/modules/data.ts#L22) Raw data operations backed by the `/bytes` endpoint. Accessed as `bee.data`. ## Constructors ### Constructor > **new Data**(`context`): `Data` Defined in: [bee-js/src/modules/data.ts:23](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/modules/data.ts#L23) #### Parameters ##### context `BeeContext` #### Returns `Data` ## Methods ### download() > **download**(`resource`, `options?`, `requestOptions?`): `Promise`\<[`Bytes`](../classes/Bytes.md)\> Defined in: [bee-js/src/modules/data.ts:58](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/modules/data.ts#L58) Downloads raw data through the `GET /bytes/{reference}` endpoint. #### Parameters ##### resource Swarm reference, Swarm CID, or ENS domain. `string` | `Uint8Array`\<`ArrayBufferLike`\> | [`Reference`](../classes/Reference.md) ##### options? [`DownloadOptions`](../interfaces/DownloadOptions.md) Options that affects the request behavior ##### requestOptions? [`BeeRequestOptions`](../type-aliases/BeeRequestOptions.md) Options for making requests, such as timeouts, custom HTTP agents, headers, etc. #### Returns `Promise`\<[`Bytes`](../classes/Bytes.md)\> *** ### downloadReadable() > **downloadReadable**(`resource`, `options?`, `requestOptions?`): `Promise`\<`ReadableStream`\<`Uint8Array`\<`ArrayBufferLike`\>\>\> Defined in: [bee-js/src/modules/data.ts:79](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/modules/data.ts#L79) Downloads raw data through the `GET /bytes/{reference}` endpoint as a readable stream. Only tested in Node.js environment. #### Parameters ##### resource Swarm reference, Swarm CID, or ENS domain. `string` | `Uint8Array`\<`ArrayBufferLike`\> | [`Reference`](../classes/Reference.md) ##### options? [`DownloadOptions`](../interfaces/DownloadOptions.md) Options that affects the request behavior. ##### requestOptions? [`BeeRequestOptions`](../type-aliases/BeeRequestOptions.md) Options for making requests, such as timeouts, custom HTTP agents, headers, etc. #### Returns `Promise`\<`ReadableStream`\<`Uint8Array`\<`ArrayBufferLike`\>\>\> *** ### isRetrievable() > **isRetrievable**(`reference`, `requestOptions?`): `Promise`\<`boolean`\> Defined in: [bee-js/src/modules/data.ts:116](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/modules/data.ts#L116) Checks if content specified by reference is retrievable from the network. #### Parameters ##### reference Bee reference to be checked in hex string (either 64 or 128 chars long) or ENS domain. `string` | `Uint8Array`\<`ArrayBufferLike`\> | [`Reference`](../classes/Reference.md) ##### requestOptions? [`BeeRequestOptions`](../type-aliases/BeeRequestOptions.md) Options for making requests, such as timeouts, custom HTTP agents, headers, etc. #### Returns `Promise`\<`boolean`\> *** ### probe() > **probe**(`reference`, `requestOptions?`): `Promise`\<[`ReferenceInformation`](../interfaces/ReferenceInformation.md)\> Defined in: [bee-js/src/modules/data.ts:101](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/modules/data.ts#L101) Fetches content length for a `/bytes` reference through the `HEAD /bytes/{reference}` endpoint. #### Parameters ##### reference `string` | `Uint8Array`\<`ArrayBufferLike`\> | [`Reference`](../classes/Reference.md) ##### requestOptions? [`BeeRequestOptions`](../type-aliases/BeeRequestOptions.md) Options for making requests, such as timeouts, custom HTTP agents, headers, etc. #### Returns `Promise`\<[`ReferenceInformation`](../interfaces/ReferenceInformation.md)\> *** ### upload() > **upload**(`postageBatchId`, `data`, `options?`, `requestOptions?`): `Promise`\<[`UploadResult`](../interfaces/UploadResult.md)\> Defined in: [bee-js/src/modules/data.ts:35](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/modules/data.ts#L35) Uploads raw data through the `POST /bytes` endpoint. Data uploaded with this method should be retrieved with [download](#download). #### Parameters ##### postageBatchId Usable Postage Batch ID with sufficient capacity to upload the data. `string` | `Uint8Array`\<`ArrayBufferLike`\> | [`BatchId`](../classes/BatchId.md) ##### data A `string` (text data) or `Uint8Array` (raw data) to be uploaded. `string` | `Uint8Array`\<`ArrayBufferLike`\> | `Blob` | `Readable` ##### options? [`RedundantUploadOptions`](../interfaces/RedundantUploadOptions.md) Additional options like tag, encryption, pinning, content-type and request options. ##### requestOptions? [`BeeRequestOptions`](../type-aliases/BeeRequestOptions.md) Options for making requests, such as timeouts, custom HTTP agents, headers, etc. #### Returns `Promise`\<[`UploadResult`](../interfaces/UploadResult.md)\> --- ## Class: Duration Defined in: [bee-js/src/utils/duration.ts:3](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/utils/duration.ts#L3) ## Properties ### ZERO > `static` **ZERO**: `Duration` Defined in: [bee-js/src/utils/duration.ts:5](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/utils/duration.ts#L5) ## Methods ### isZero() > **isZero**(): `boolean` Defined in: [bee-js/src/utils/duration.ts:98](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/utils/duration.ts#L98) #### Returns `boolean` *** ### represent() > **represent**(): `string` Defined in: [bee-js/src/utils/duration.ts:94](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/utils/duration.ts#L94) #### Returns `string` *** ### toDays() > **toDays**(): `number` Defined in: [bee-js/src/utils/duration.ts:78](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/utils/duration.ts#L78) #### Returns `number` *** ### toEndDate() > **toEndDate**(`startDate?`): `Date` Defined in: [bee-js/src/utils/duration.ts:90](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/utils/duration.ts#L90) #### Parameters ##### startDate? `Date` #### Returns `Date` *** ### toHours() > **toHours**(): `number` Defined in: [bee-js/src/utils/duration.ts:74](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/utils/duration.ts#L74) #### Returns `number` *** ### toSeconds() > **toSeconds**(): `number` Defined in: [bee-js/src/utils/duration.ts:70](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/utils/duration.ts#L70) #### Returns `number` *** ### toWeeks() > **toWeeks**(): `number` Defined in: [bee-js/src/utils/duration.ts:82](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/utils/duration.ts#L82) #### Returns `number` *** ### toYears() > **toYears**(): `number` Defined in: [bee-js/src/utils/duration.ts:86](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/utils/duration.ts#L86) #### Returns `number` *** ### fromDays() > `static` **fromDays**(`days`): `Duration` Defined in: [bee-js/src/utils/duration.ts:27](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/utils/duration.ts#L27) #### Parameters ##### days `number` #### Returns `Duration` *** ### fromEndDate() > `static` **fromEndDate**(`endDate`, `startDate?`): `Duration` Defined in: [bee-js/src/utils/duration.ts:39](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/utils/duration.ts#L39) #### Parameters ##### endDate `Date` ##### startDate? `Date` #### Returns `Duration` *** ### fromHours() > `static` **fromHours**(`hours`): `Duration` Defined in: [bee-js/src/utils/duration.ts:23](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/utils/duration.ts#L23) #### Parameters ##### hours `number` #### Returns `Duration` *** ### fromMilliseconds() > `static` **fromMilliseconds**(`milliseconds`): `Duration` Defined in: [bee-js/src/utils/duration.ts:15](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/utils/duration.ts#L15) #### Parameters ##### milliseconds `number` #### Returns `Duration` *** ### fromSeconds() > `static` **fromSeconds**(`seconds`): `Duration` Defined in: [bee-js/src/utils/duration.ts:19](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/utils/duration.ts#L19) #### Parameters ##### seconds `number` #### Returns `Duration` *** ### fromWeeks() > `static` **fromWeeks**(`weeks`): `Duration` Defined in: [bee-js/src/utils/duration.ts:31](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/utils/duration.ts#L31) #### Parameters ##### weeks `number` #### Returns `Duration` *** ### fromYears() > `static` **fromYears**(`years`): `Duration` Defined in: [bee-js/src/utils/duration.ts:35](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/utils/duration.ts#L35) #### Parameters ##### years `number` #### Returns `Duration` *** ### parseFromString() > `static` **parseFromString**(`duration`): `Duration` Defined in: [bee-js/src/utils/duration.ts:66](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/utils/duration.ts#L66) Parses a duration string and returns a `Duration` instance. Case insensitive. E.g. both `"28h"` and `"1D"` are valid. Whitespaces are ignored. E.g. both `"5 d"` and `"2weeks"` are valid. Decimal numbers are supported. E.g. `"1.5h"` is valid. Supported units: - ms, milli, millis, millisecond, milliseconds - s, sec, second, seconds - m, min, minute, minutes - h, hour, hours - d, day, days - w, week, weeks - month, months - y, year, years #### Parameters ##### duration `string` A string representing a duration #### Returns `Duration` a `Duration` instance --- ## Class: EthAddress Defined in: [core-sdk/src/bytes/eth-address.ts:7](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/eth-address.ts#L7) A 20-byte Ethereum address. ## Extends - [`Bytes`](Bytes.md) ## Constructors ### Constructor > **new EthAddress**(`bytes`): `EthAddress` Defined in: [core-sdk/src/bytes/eth-address.ts:10](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/eth-address.ts#L10) #### Parameters ##### bytes `string` | `Uint8Array`\<`ArrayBufferLike`\> | [`Bytes`](Bytes.md) #### Returns `EthAddress` #### Overrides [`Bytes`](Bytes.md).[`constructor`](Bytes.md#constructor) ## Properties ### length > `readonly` **length**: `number` Defined in: [core-sdk/src/bytes/bytes.ts:19](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L19) #### Inherited from [`Bytes`](Bytes.md).[`length`](Bytes.md#length) *** ### LENGTH > `readonly` `static` **LENGTH**: `20` = `20` Defined in: [core-sdk/src/bytes/eth-address.ts:8](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/eth-address.ts#L8) ## Methods ### equals() > **equals**(`other`): `boolean` Defined in: [core-sdk/src/bytes/bytes.ts:173](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L173) Byte-wise equality against another Bytes instance, raw bytes, or hex string. #### Parameters ##### other `string` | `Uint8Array`\<`ArrayBufferLike`\> | [`Bytes`](Bytes.md) #### Returns `boolean` #### Inherited from [`Bytes`](Bytes.md).[`equals`](Bytes.md#equals) *** ### offset() > **offset**(`index`): `Uint8Array` Defined in: [core-sdk/src/bytes/bytes.ts:110](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L110) Returns a copy of the bytes from `index` to the end. #### Parameters ##### index `number` #### Returns `Uint8Array` #### Inherited from [`Bytes`](Bytes.md).[`offset`](Bytes.md#offset) *** ### parsePayloadAsJson() > **parsePayloadAsJson**(): `unknown` Defined in: [core-sdk/src/bytes/bytes.ts:159](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L159) Parses the bytes as UTF-8 JSON. #### Returns `unknown` #### Inherited from [`Bytes`](Bytes.md).[`parsePayloadAsJson`](Bytes.md#parsepayloadasjson) *** ### represent() > **represent**(): `string` Defined in: [core-sdk/src/bytes/bytes.ts:180](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L180) Human-readable representation, used by debuggers/loggers. Same as [toHex](Bytes.md#tohex). #### Returns `string` #### Inherited from [`Bytes`](Bytes.md).[`represent`](Bytes.md#represent) *** ### toBase32() > **toBase32**(): `string` Defined in: [core-sdk/src/bytes/bytes.ts:138](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L138) Encodes as a padded base32 string. #### Returns `string` #### Inherited from [`Bytes`](Bytes.md).[`toBase32`](Bytes.md#tobase32) *** ### toBase64() > **toBase64**(): `string` Defined in: [core-sdk/src/bytes/bytes.ts:131](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L131) Encodes as a padded base64 string. #### Returns `string` #### Inherited from [`Bytes`](Bytes.md).[`toBase64`](Bytes.md#tobase64) *** ### toChecksum() > **toChecksum**(): `string` Defined in: [core-sdk/src/bytes/eth-address.ts:17](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/eth-address.ts#L17) EIP-55 checksum-cased hex representation (e.g. `0x5aAe...`). #### Returns `string` *** ### toHex() > **toHex**(): `string` Defined in: [core-sdk/src/bytes/bytes.ts:124](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L124) Encodes as a lowercase hex string, with no `0x` prefix. #### Returns `string` #### Inherited from [`Bytes`](Bytes.md).[`toHex`](Bytes.md#tohex) *** ### toJSON() > **toJSON**(): `string` Defined in: [core-sdk/src/bytes/bytes.ts:166](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L166) Serialized as its hex string by `JSON.stringify`. #### Returns `string` #### Inherited from [`Bytes`](Bytes.md).[`toJSON`](Bytes.md#tojson) *** ### toString() > **toString**(): `string` Defined in: [core-sdk/src/bytes/bytes.ts:145](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L145) Same as [toHex](Bytes.md#tohex). #### Returns `string` #### Inherited from [`Bytes`](Bytes.md).[`toString`](Bytes.md#tostring) *** ### toUint8Array() > **toUint8Array**(): `Uint8Array` Defined in: [core-sdk/src/bytes/bytes.ts:117](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L117) Returns a copy of the underlying bytes. #### Returns `Uint8Array` #### Inherited from [`Bytes`](Bytes.md).[`toUint8Array`](Bytes.md#touint8array) *** ### toUtf8() > **toUtf8**(): `string` Defined in: [core-sdk/src/bytes/bytes.ts:152](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L152) Decodes the bytes as UTF-8 text. #### Returns `string` #### Inherited from [`Bytes`](Bytes.md).[`toUtf8`](Bytes.md#toutf8) *** ### concat() > `static` **concat**(...`arrays`): `Uint8Array` Defined in: [core-sdk/src/bytes/bytes.ts:75](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L75) Concatenates any number of byte arrays (or Bytes instances) into one new array. #### Parameters ##### arrays ...(`Uint8Array`\<`ArrayBufferLike`\> \| [`Bytes`](Bytes.md))[] #### Returns `Uint8Array` #### Inherited from [`Bytes`](Bytes.md).[`concat`](Bytes.md#concat) *** ### fromSlice() > `static` **fromSlice**(`bytes`, `start`, `length?`): [`Bytes`](Bytes.md) Defined in: [core-sdk/src/bytes/bytes.ts:100](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L100) Wraps a slice of `bytes` starting at `start`, running to the end unless `length` is given. #### Parameters ##### bytes `Uint8Array` ##### start `number` ##### length? `number` #### Returns [`Bytes`](Bytes.md) #### Inherited from [`Bytes`](Bytes.md).[`fromSlice`](Bytes.md#fromslice) *** ### fromUtf8() > `static` **fromUtf8**(`utf8`): [`Bytes`](Bytes.md) Defined in: [core-sdk/src/bytes/bytes.ts:92](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L92) Wraps the UTF-8 encoding of a string. #### Parameters ##### utf8 `string` #### Returns [`Bytes`](Bytes.md) #### Inherited from [`Bytes`](Bytes.md).[`fromUtf8`](Bytes.md#fromutf8) *** ### keccak256() > `static` **keccak256**(`bytes`): [`Bytes`](Bytes.md) Defined in: [core-sdk/src/bytes/bytes.ts:68](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L68) Hashes `bytes` with keccak256 and wraps the 32-byte digest. #### Parameters ##### bytes `string` | `ArrayBuffer` | `Uint8Array`\<`ArrayBufferLike`\> | [`Bytes`](Bytes.md) #### Returns [`Bytes`](Bytes.md) #### Inherited from [`Bytes`](Bytes.md).[`keccak256`](Bytes.md#keccak256) --- ## Class: Feed Defined in: [bee-js/src/modules/feed.ts:17](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/modules/feed.ts#L17) Feed operations. Accessed as `bee.feed`. Delegates to the feed subsystem (`src/feed`). ## Constructors ### Constructor > **new Feed**(`context`): `Feed` Defined in: [bee-js/src/modules/feed.ts:18](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/modules/feed.ts#L18) #### Parameters ##### context `BeeContext` #### Returns `Feed` ## Methods ### createManifest() > **createManifest**(`postageBatchId`, `topic`, `owner`, `options?`, `requestOptions?`): `Promise`\<[`Reference`](../classes/Reference.md)\> Defined in: [bee-js/src/modules/feed.ts:69](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/modules/feed.ts#L69) Creates a feed manifest chunk and returns the reference to it. #### Parameters ##### postageBatchId Postage BatchId to be used to create the Feed Manifest `string` | `Uint8Array`\<`ArrayBufferLike`\> | [`BatchId`](../classes/BatchId.md) ##### topic Topic in hex or bytes `string` | `Uint8Array`\<`ArrayBufferLike`\> | [`Topic`](../classes/Topic.md) ##### owner Owner's ethereum address in hex or bytes `string` | `Uint8Array`\<`ArrayBufferLike`\> | [`EthAddress`](../classes/EthAddress.md) ##### options? [`UploadOptions`](../interfaces/UploadOptions.md) Options that affect the request behavior ##### requestOptions? [`BeeRequestOptions`](../type-aliases/BeeRequestOptions.md) Options for making requests, such as timeouts, custom HTTP agents, headers, etc. #### Returns `Promise`\<[`Reference`](../classes/Reference.md)\> *** ### fetchLatestUpdate() > **fetchLatestUpdate**(`topic`, `owner`, `requestOptions?`): `Promise`\<`FeedPayloadResult`\> Defined in: [bee-js/src/modules/feed.ts:100](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/modules/feed.ts#L100) Fetches the latest feed update. #### Parameters ##### topic Topic in hex or bytes `string` | `Uint8Array`\<`ArrayBufferLike`\> | [`Topic`](../classes/Topic.md) ##### owner Owner's ethereum address in hex or bytes `string` | `Uint8Array`\<`ArrayBufferLike`\> | [`EthAddress`](../classes/EthAddress.md) ##### requestOptions? [`BeeRequestOptions`](../type-aliases/BeeRequestOptions.md) Options for making requests, such as timeouts, custom HTTP agents, headers, etc. #### Returns `Promise`\<`FeedPayloadResult`\> *** ### isRetrievable() > **isRetrievable**(`owner`, `topic`, `index?`, `options?`, `requestOptions?`): `Promise`\<`boolean`\> Defined in: [bee-js/src/modules/feed.ts:121](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/modules/feed.ts#L121) Validates whether a feed is retrievable in the network. #### Parameters ##### owner Owner's ethereum address in hex or bytes `string` | `Uint8Array`\<`ArrayBufferLike`\> | [`EthAddress`](../classes/EthAddress.md) ##### topic Topic in hex or bytes `string` | `Uint8Array`\<`ArrayBufferLike`\> | [`Topic`](../classes/Topic.md) ##### index? [`FeedIndex`](../classes/FeedIndex.md) Optional feed index ##### options? [`DownloadOptions`](../interfaces/DownloadOptions.md) Download options ##### requestOptions? [`BeeRequestOptions`](../type-aliases/BeeRequestOptions.md) Options for making requests, such as timeouts, custom HTTP agents, headers, etc. #### Returns `Promise`\<`boolean`\> *** ### makeReader() > **makeReader**(`topic`, `owner`, `requestOptions?`): [`FeedReader`](../interfaces/FeedReader.md) Defined in: [bee-js/src/modules/feed.ts:27](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/modules/feed.ts#L27) Makes a new feed reader for downloading feed updates. #### Parameters ##### topic Topic in hex or bytes `string` | `Uint8Array`\<`ArrayBufferLike`\> | [`Topic`](../classes/Topic.md) ##### owner Owner's ethereum address in hex or bytes `string` | `Uint8Array`\<`ArrayBufferLike`\> | [`EthAddress`](../classes/EthAddress.md) ##### requestOptions? [`BeeRequestOptions`](../type-aliases/BeeRequestOptions.md) Options for making requests, such as timeouts, custom HTTP agents, headers, etc. #### Returns [`FeedReader`](../interfaces/FeedReader.md) *** ### makeWriter() > **makeWriter**(`topic`, `signer?`, `requestOptions?`): [`FeedWriter`](../interfaces/FeedWriter.md) Defined in: [bee-js/src/modules/feed.ts:46](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/modules/feed.ts#L46) Makes a new feed writer for updating feeds. #### Parameters ##### topic Topic in hex or bytes `string` | `Uint8Array`\<`ArrayBufferLike`\> | [`Topic`](../classes/Topic.md) ##### signer? The signer's private key. Falls back to the Bee instance signer. `string` | `Uint8Array`\<`ArrayBufferLike`\> | [`PrivateKey`](../classes/PrivateKey.md) ##### requestOptions? [`BeeRequestOptions`](../type-aliases/BeeRequestOptions.md) Options for making requests, such as timeouts, custom HTTP agents, headers, etc. #### Returns [`FeedWriter`](../interfaces/FeedWriter.md) --- ## Class: FeedIndex Defined in: [core-sdk/src/bytes/feed-index.ts:9](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/feed-index.ts#L9) An 8-byte, big-endian sequential feed update index. ## Extends - [`Bytes`](Bytes.md) ## Constructors ### Constructor > **new FeedIndex**(`bytes`): `FeedIndex` Defined in: [core-sdk/src/bytes/feed-index.ts:14](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/feed-index.ts#L14) #### Parameters ##### bytes `string` | `Uint8Array`\<`ArrayBufferLike`\> | [`Bytes`](Bytes.md) #### Returns `FeedIndex` #### Overrides [`Bytes`](Bytes.md).[`constructor`](Bytes.md#constructor) ## Properties ### length > `readonly` **length**: `number` Defined in: [core-sdk/src/bytes/bytes.ts:19](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L19) #### Inherited from [`Bytes`](Bytes.md).[`length`](Bytes.md#length) *** ### LENGTH > `readonly` `static` **LENGTH**: `8` = `8` Defined in: [core-sdk/src/bytes/feed-index.ts:10](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/feed-index.ts#L10) *** ### MINUS\_ONE > `readonly` `static` **MINUS\_ONE**: `FeedIndex` Defined in: [core-sdk/src/bytes/feed-index.ts:12](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/feed-index.ts#L12) Sentinel index (all bits set) some feed types use to mean "no update yet". ## Methods ### equals() > **equals**(`other`): `boolean` Defined in: [core-sdk/src/bytes/bytes.ts:173](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L173) Byte-wise equality against another Bytes instance, raw bytes, or hex string. #### Parameters ##### other `string` | `Uint8Array`\<`ArrayBufferLike`\> | [`Bytes`](Bytes.md) #### Returns `boolean` #### Inherited from [`Bytes`](Bytes.md).[`equals`](Bytes.md#equals) *** ### next() > **next**(): `FeedIndex` Defined in: [core-sdk/src/bytes/feed-index.ts:35](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/feed-index.ts#L35) Returns the next sequential index, wrapping [MINUS\_ONE](#minus_one) back to 0. #### Returns `FeedIndex` *** ### offset() > **offset**(`index`): `Uint8Array` Defined in: [core-sdk/src/bytes/bytes.ts:110](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L110) Returns a copy of the bytes from `index` to the end. #### Parameters ##### index `number` #### Returns `Uint8Array` #### Inherited from [`Bytes`](Bytes.md).[`offset`](Bytes.md#offset) *** ### parsePayloadAsJson() > **parsePayloadAsJson**(): `unknown` Defined in: [core-sdk/src/bytes/bytes.ts:159](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L159) Parses the bytes as UTF-8 JSON. #### Returns `unknown` #### Inherited from [`Bytes`](Bytes.md).[`parsePayloadAsJson`](Bytes.md#parsepayloadasjson) *** ### represent() > **represent**(): `string` Defined in: [core-sdk/src/bytes/bytes.ts:180](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L180) Human-readable representation, used by debuggers/loggers. Same as [toHex](Bytes.md#tohex). #### Returns `string` #### Inherited from [`Bytes`](Bytes.md).[`represent`](Bytes.md#represent) *** ### toBase32() > **toBase32**(): `string` Defined in: [core-sdk/src/bytes/bytes.ts:138](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L138) Encodes as a padded base32 string. #### Returns `string` #### Inherited from [`Bytes`](Bytes.md).[`toBase32`](Bytes.md#tobase32) *** ### toBase64() > **toBase64**(): `string` Defined in: [core-sdk/src/bytes/bytes.ts:131](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L131) Encodes as a padded base64 string. #### Returns `string` #### Inherited from [`Bytes`](Bytes.md).[`toBase64`](Bytes.md#tobase64) *** ### toBigInt() > **toBigInt**(): `bigint` Defined in: [core-sdk/src/bytes/feed-index.ts:28](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/feed-index.ts#L28) Decodes the index as a bigint. #### Returns `bigint` *** ### toHex() > **toHex**(): `string` Defined in: [core-sdk/src/bytes/bytes.ts:124](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L124) Encodes as a lowercase hex string, with no `0x` prefix. #### Returns `string` #### Inherited from [`Bytes`](Bytes.md).[`toHex`](Bytes.md#tohex) *** ### toJSON() > **toJSON**(): `string` Defined in: [core-sdk/src/bytes/bytes.ts:166](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L166) Serialized as its hex string by `JSON.stringify`. #### Returns `string` #### Inherited from [`Bytes`](Bytes.md).[`toJSON`](Bytes.md#tojson) *** ### toString() > **toString**(): `string` Defined in: [core-sdk/src/bytes/bytes.ts:145](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L145) Same as [toHex](Bytes.md#tohex). #### Returns `string` #### Inherited from [`Bytes`](Bytes.md).[`toString`](Bytes.md#tostring) *** ### toUint8Array() > **toUint8Array**(): `Uint8Array` Defined in: [core-sdk/src/bytes/bytes.ts:117](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L117) Returns a copy of the underlying bytes. #### Returns `Uint8Array` #### Inherited from [`Bytes`](Bytes.md).[`toUint8Array`](Bytes.md#touint8array) *** ### toUtf8() > **toUtf8**(): `string` Defined in: [core-sdk/src/bytes/bytes.ts:152](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L152) Decodes the bytes as UTF-8 text. #### Returns `string` #### Inherited from [`Bytes`](Bytes.md).[`toUtf8`](Bytes.md#toutf8) *** ### concat() > `static` **concat**(...`arrays`): `Uint8Array` Defined in: [core-sdk/src/bytes/bytes.ts:75](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L75) Concatenates any number of byte arrays (or Bytes instances) into one new array. #### Parameters ##### arrays ...(`Uint8Array`\<`ArrayBufferLike`\> \| [`Bytes`](Bytes.md))[] #### Returns `Uint8Array` #### Inherited from [`Bytes`](Bytes.md).[`concat`](Bytes.md#concat) *** ### fromBigInt() > `static` **fromBigInt**(`value`): `FeedIndex` Defined in: [core-sdk/src/bytes/feed-index.ts:21](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/feed-index.ts#L21) Encodes a bigint index as an 8-byte, big-endian FeedIndex. #### Parameters ##### value `bigint` #### Returns `FeedIndex` *** ### fromSlice() > `static` **fromSlice**(`bytes`, `start`, `length?`): [`Bytes`](Bytes.md) Defined in: [core-sdk/src/bytes/bytes.ts:100](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L100) Wraps a slice of `bytes` starting at `start`, running to the end unless `length` is given. #### Parameters ##### bytes `Uint8Array` ##### start `number` ##### length? `number` #### Returns [`Bytes`](Bytes.md) #### Inherited from [`Bytes`](Bytes.md).[`fromSlice`](Bytes.md#fromslice) *** ### fromUtf8() > `static` **fromUtf8**(`utf8`): [`Bytes`](Bytes.md) Defined in: [core-sdk/src/bytes/bytes.ts:92](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L92) Wraps the UTF-8 encoding of a string. #### Parameters ##### utf8 `string` #### Returns [`Bytes`](Bytes.md) #### Inherited from [`Bytes`](Bytes.md).[`fromUtf8`](Bytes.md#fromutf8) *** ### keccak256() > `static` **keccak256**(`bytes`): [`Bytes`](Bytes.md) Defined in: [core-sdk/src/bytes/bytes.ts:68](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L68) Hashes `bytes` with keccak256 and wraps the 32-byte digest. #### Parameters ##### bytes `string` | `ArrayBuffer` | `Uint8Array`\<`ArrayBufferLike`\> | [`Bytes`](Bytes.md) #### Returns [`Bytes`](Bytes.md) #### Inherited from [`Bytes`](Bytes.md).[`keccak256`](Bytes.md#keccak256) --- ## Class: File Defined in: [bee-js/src/modules/file.ts:16](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/modules/file.ts#L16) Single-file operations backed by the `/bzz` endpoint. Accessed as `bee.file`. ## Constructors ### Constructor > **new File**(`context`): `File` Defined in: [bee-js/src/modules/file.ts:17](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/modules/file.ts#L17) #### Parameters ##### context `BeeContext` #### Returns `File` ## Methods ### download() > **download**(`resource`, `path`, `options?`, `requestOptions?`): `Promise`\<[`FileData`](../interfaces/FileData.md)\<[`Bytes`](../classes/Bytes.md)\>\> Defined in: [bee-js/src/modules/file.ts:74](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/modules/file.ts#L74) Downloads a single file. #### Parameters ##### resource Swarm reference, Swarm CID, or ENS domain. `string` | `Uint8Array`\<`ArrayBufferLike`\> | [`Reference`](../classes/Reference.md) ##### path `string` = `''` If reference points to manifest, then this parameter defines path to the file ##### options? [`DownloadOptions`](../interfaces/DownloadOptions.md) Options that affects the request behavior ##### requestOptions? [`BeeRequestOptions`](../type-aliases/BeeRequestOptions.md) Options for making requests, such as timeouts, custom HTTP agents, headers, etc. #### Returns `Promise`\<[`FileData`](../interfaces/FileData.md)\<[`Bytes`](../classes/Bytes.md)\>\> *** ### downloadReadable() > **downloadReadable**(`reference`, `path`, `options?`, `requestOptions?`): `Promise`\<[`FileData`](../interfaces/FileData.md)\<`ReadableStream`\<`Uint8Array`\<`ArrayBufferLike`\>\>\>\> Defined in: [bee-js/src/modules/file.ts:100](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/modules/file.ts#L100) Downloads a single file as a readable stream. #### Parameters ##### reference Bee file reference in hex string (either 64 or 128 chars long), ENS domain or Swarm CID. `string` | `Uint8Array`\<`ArrayBufferLike`\> | [`Reference`](../classes/Reference.md) ##### path `string` = `''` If reference points to manifest / collections, then this parameter defines path to the file ##### options? [`DownloadOptions`](../interfaces/DownloadOptions.md) Options that affects the request behavior ##### requestOptions? [`BeeRequestOptions`](../type-aliases/BeeRequestOptions.md) Options for making requests, such as timeouts, custom HTTP agents, headers, etc. #### Returns `Promise`\<[`FileData`](../interfaces/FileData.md)\<`ReadableStream`\<`Uint8Array`\<`ArrayBufferLike`\>\>\>\> *** ### upload() > **upload**(`postageBatchId`, `data`, `name?`, `options?`, `requestOptions?`): `Promise`\<[`UploadResult`](../interfaces/UploadResult.md)\> Defined in: [bee-js/src/modules/file.ts:30](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/modules/file.ts#L30) Uploads a single file to a Bee node. To download the file, use [download](#download). #### Parameters ##### postageBatchId Postage BatchId to be used to upload the data with `string` | `Uint8Array`\<`ArrayBufferLike`\> | [`BatchId`](../classes/BatchId.md) ##### data Data or file to be uploaded `string` | `Uint8Array`\<`ArrayBufferLike`\> | `File` | `Readable` ##### name? `string` Optional name of the uploaded file ##### options? [`FileUploadOptions`](../interfaces/FileUploadOptions.md) Additional options like tag, encryption, pinning, content-type and request options ##### requestOptions? [`BeeRequestOptions`](../type-aliases/BeeRequestOptions.md) Options for making requests, such as timeouts, custom HTTP agents, headers, etc. #### Returns `Promise`\<[`UploadResult`](../interfaces/UploadResult.md)\> --- ## Class: Grantee Defined in: [bee-js/src/modules/grantee.ts:11](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/modules/grantee.ts#L11) Grantee (access control) operations. Accessed as `bee.grantee`. ## Constructors ### Constructor > **new Grantee**(`context`): `Grantee` Defined in: [bee-js/src/modules/grantee.ts:12](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/modules/grantee.ts#L12) #### Parameters ##### context `BeeContext` #### Returns `Grantee` ## Methods ### create() > **create**(`postageBatchId`, `grantees`, `requestOptions?`): `Promise`\<[`GranteesResult`](../interfaces/GranteesResult.md)\> Defined in: [bee-js/src/modules/grantee.ts:21](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/modules/grantee.ts#L21) Creates grantees for a postage batch. #### Parameters ##### postageBatchId `string` | `Uint8Array`\<`ArrayBufferLike`\> | [`BatchId`](../classes/BatchId.md) ##### grantees Public keys of the grantees. `string`[] | `Uint8Array`\<`ArrayBufferLike`\>[] | [`PublicKey`](../classes/PublicKey.md)[] ##### requestOptions? [`BeeRequestOptions`](../type-aliases/BeeRequestOptions.md) Options for making requests, such as timeouts, custom HTTP agents, headers, etc. #### Returns `Promise`\<[`GranteesResult`](../interfaces/GranteesResult.md)\> *** ### get() > **get**(`reference`, `requestOptions?`): `Promise`\<[`GetGranteesResult`](../interfaces/GetGranteesResult.md)\> Defined in: [bee-js/src/modules/grantee.ts:38](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/modules/grantee.ts#L38) Retrieves the grantees for a given reference. #### Parameters ##### reference The reference. `string` | `Uint8Array`\<`ArrayBufferLike`\> | [`Reference`](../classes/Reference.md) ##### requestOptions? [`BeeRequestOptions`](../type-aliases/BeeRequestOptions.md) Options for making requests, such as timeouts, custom HTTP agents, headers, etc. #### Returns `Promise`\<[`GetGranteesResult`](../interfaces/GetGranteesResult.md)\> *** ### patch() > **patch**(`postageBatchId`, `reference`, `history`, `grantees`, `requestOptions?`): `Promise`\<[`GranteesResult`](../interfaces/GranteesResult.md)\> Defined in: [bee-js/src/modules/grantee.ts:56](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/modules/grantee.ts#L56) Updates the grantees of a specific reference and history. #### Parameters ##### postageBatchId The ID of the postage batch. `string` | `Uint8Array`\<`ArrayBufferLike`\> | [`BatchId`](../classes/BatchId.md) ##### reference The reference. `string` | `Uint8Array`\<`ArrayBufferLike`\> | [`Reference`](../classes/Reference.md) ##### history The history. `string` | `Uint8Array`\<`ArrayBufferLike`\> | [`Reference`](../classes/Reference.md) ##### grantees The grantees to add and/or revoke. ###### add? `string`[] \| `Uint8Array`\<`ArrayBufferLike`\>[] \| [`PublicKey`](../classes/PublicKey.md)[] ###### revoke? `string`[] \| `Uint8Array`\<`ArrayBufferLike`\>[] \| [`PublicKey`](../classes/PublicKey.md)[] ##### requestOptions? [`BeeRequestOptions`](../type-aliases/BeeRequestOptions.md) Options for making requests, such as timeouts, custom HTTP agents, headers, etc. #### Returns `Promise`\<[`GranteesResult`](../interfaces/GranteesResult.md)\> --- ## Class: Identifier Defined in: [core-sdk/src/bytes/identifier.ts:10](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/identifier.ts#L10) A 32-byte feed/SOC identifier - an arbitrary value selected by the uploader that, together with the owner's address, determines a single-owner chunk's address. ## Extends - [`Bytes`](Bytes.md) ## Constructors ### Constructor > **new Identifier**(`bytes`): `Identifier` Defined in: [core-sdk/src/bytes/identifier.ts:13](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/identifier.ts#L13) #### Parameters ##### bytes `string` | `Uint8Array`\<`ArrayBufferLike`\> | [`Bytes`](Bytes.md) #### Returns `Identifier` #### Overrides [`Bytes`](Bytes.md).[`constructor`](Bytes.md#constructor) ## Properties ### length > `readonly` **length**: `number` Defined in: [core-sdk/src/bytes/bytes.ts:19](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L19) #### Inherited from [`Bytes`](Bytes.md).[`length`](Bytes.md#length) *** ### LENGTH > `readonly` `static` **LENGTH**: `32` = `32` Defined in: [core-sdk/src/bytes/identifier.ts:11](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/identifier.ts#L11) ## Methods ### equals() > **equals**(`other`): `boolean` Defined in: [core-sdk/src/bytes/bytes.ts:173](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L173) Byte-wise equality against another Bytes instance, raw bytes, or hex string. #### Parameters ##### other `string` | `Uint8Array`\<`ArrayBufferLike`\> | [`Bytes`](Bytes.md) #### Returns `boolean` #### Inherited from [`Bytes`](Bytes.md).[`equals`](Bytes.md#equals) *** ### offset() > **offset**(`index`): `Uint8Array` Defined in: [core-sdk/src/bytes/bytes.ts:110](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L110) Returns a copy of the bytes from `index` to the end. #### Parameters ##### index `number` #### Returns `Uint8Array` #### Inherited from [`Bytes`](Bytes.md).[`offset`](Bytes.md#offset) *** ### parsePayloadAsJson() > **parsePayloadAsJson**(): `unknown` Defined in: [core-sdk/src/bytes/bytes.ts:159](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L159) Parses the bytes as UTF-8 JSON. #### Returns `unknown` #### Inherited from [`Bytes`](Bytes.md).[`parsePayloadAsJson`](Bytes.md#parsepayloadasjson) *** ### represent() > **represent**(): `string` Defined in: [core-sdk/src/bytes/bytes.ts:180](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L180) Human-readable representation, used by debuggers/loggers. Same as [toHex](Bytes.md#tohex). #### Returns `string` #### Inherited from [`Bytes`](Bytes.md).[`represent`](Bytes.md#represent) *** ### toBase32() > **toBase32**(): `string` Defined in: [core-sdk/src/bytes/bytes.ts:138](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L138) Encodes as a padded base32 string. #### Returns `string` #### Inherited from [`Bytes`](Bytes.md).[`toBase32`](Bytes.md#tobase32) *** ### toBase64() > **toBase64**(): `string` Defined in: [core-sdk/src/bytes/bytes.ts:131](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L131) Encodes as a padded base64 string. #### Returns `string` #### Inherited from [`Bytes`](Bytes.md).[`toBase64`](Bytes.md#tobase64) *** ### toHex() > **toHex**(): `string` Defined in: [core-sdk/src/bytes/bytes.ts:124](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L124) Encodes as a lowercase hex string, with no `0x` prefix. #### Returns `string` #### Inherited from [`Bytes`](Bytes.md).[`toHex`](Bytes.md#tohex) *** ### toJSON() > **toJSON**(): `string` Defined in: [core-sdk/src/bytes/bytes.ts:166](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L166) Serialized as its hex string by `JSON.stringify`. #### Returns `string` #### Inherited from [`Bytes`](Bytes.md).[`toJSON`](Bytes.md#tojson) *** ### toString() > **toString**(): `string` Defined in: [core-sdk/src/bytes/bytes.ts:145](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L145) Same as [toHex](Bytes.md#tohex). #### Returns `string` #### Inherited from [`Bytes`](Bytes.md).[`toString`](Bytes.md#tostring) *** ### toUint8Array() > **toUint8Array**(): `Uint8Array` Defined in: [core-sdk/src/bytes/bytes.ts:117](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L117) Returns a copy of the underlying bytes. #### Returns `Uint8Array` #### Inherited from [`Bytes`](Bytes.md).[`toUint8Array`](Bytes.md#touint8array) *** ### toUtf8() > **toUtf8**(): `string` Defined in: [core-sdk/src/bytes/bytes.ts:152](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L152) Decodes the bytes as UTF-8 text. #### Returns `string` #### Inherited from [`Bytes`](Bytes.md).[`toUtf8`](Bytes.md#toutf8) *** ### concat() > `static` **concat**(...`arrays`): `Uint8Array` Defined in: [core-sdk/src/bytes/bytes.ts:75](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L75) Concatenates any number of byte arrays (or Bytes instances) into one new array. #### Parameters ##### arrays ...(`Uint8Array`\<`ArrayBufferLike`\> \| [`Bytes`](Bytes.md))[] #### Returns `Uint8Array` #### Inherited from [`Bytes`](Bytes.md).[`concat`](Bytes.md#concat) *** ### fromSlice() > `static` **fromSlice**(`bytes`, `start`, `length?`): [`Bytes`](Bytes.md) Defined in: [core-sdk/src/bytes/bytes.ts:100](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L100) Wraps a slice of `bytes` starting at `start`, running to the end unless `length` is given. #### Parameters ##### bytes `Uint8Array` ##### start `number` ##### length? `number` #### Returns [`Bytes`](Bytes.md) #### Inherited from [`Bytes`](Bytes.md).[`fromSlice`](Bytes.md#fromslice) *** ### fromString() > `static` **fromString**(`value`): `Identifier` Defined in: [core-sdk/src/bytes/identifier.ts:20](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/identifier.ts#L20) Derives an identifier by hashing an arbitrary string with keccak256. #### Parameters ##### value `string` #### Returns `Identifier` *** ### fromUtf8() > `static` **fromUtf8**(`utf8`): [`Bytes`](Bytes.md) Defined in: [core-sdk/src/bytes/bytes.ts:92](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L92) Wraps the UTF-8 encoding of a string. #### Parameters ##### utf8 `string` #### Returns [`Bytes`](Bytes.md) #### Inherited from [`Bytes`](Bytes.md).[`fromUtf8`](Bytes.md#fromutf8) *** ### keccak256() > `static` **keccak256**(`bytes`): [`Bytes`](Bytes.md) Defined in: [core-sdk/src/bytes/bytes.ts:68](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L68) Hashes `bytes` with keccak256 and wraps the 32-byte digest. #### Parameters ##### bytes `string` | `ArrayBuffer` | `Uint8Array`\<`ArrayBufferLike`\> | [`Bytes`](Bytes.md) #### Returns [`Bytes`](Bytes.md) #### Inherited from [`Bytes`](Bytes.md).[`keccak256`](Bytes.md#keccak256) --- ## Class: MantarayNode Defined in: [bee-js/src/manifest/manifest.ts:77](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/manifest/manifest.ts#L77) 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](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/manifest/manifest.ts#L80) #### Parameters ##### core `MantarayNode` = `...` #### Returns `MantarayNode` ## Properties ### core > `readonly` **core**: `MantarayNode` Defined in: [bee-js/src/manifest/manifest.ts:78](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/manifest/manifest.ts#L78) ## Accessors ### forks #### Get Signature > **get** **forks**(): `Map`\<`number`, \{ `node`: `MantarayNode`; `prefix`: `Uint8Array`; \}\> Defined in: [bee-js/src/manifest/manifest.ts:104](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/manifest/manifest.ts#L104) ##### Returns `Map`\<`number`, \{ `node`: `MantarayNode`; `prefix`: `Uint8Array`; \}\> *** ### fullPath #### Get Signature > **get** **fullPath**(): `Uint8Array` Defined in: [bee-js/src/manifest/manifest.ts:116](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/manifest/manifest.ts#L116) ##### Returns `Uint8Array` *** ### fullPathString #### Get Signature > **get** **fullPathString**(): `string` Defined in: [bee-js/src/manifest/manifest.ts:120](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/manifest/manifest.ts#L120) ##### Returns `string` *** ### metadata #### Get Signature > **get** **metadata**(): `Record`\<`string`, `string`\> \| `null` \| `undefined` Defined in: [bee-js/src/manifest/manifest.ts:96](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/manifest/manifest.ts#L96) ##### Returns `Record`\<`string`, `string`\> \| `null` \| `undefined` *** ### obfuscationKey #### Get Signature > **get** **obfuscationKey**(): `Uint8Array` Defined in: [bee-js/src/manifest/manifest.ts:84](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/manifest/manifest.ts#L84) ##### Returns `Uint8Array` *** ### parent #### Get Signature > **get** **parent**(): `MantarayNode` \| `null` Defined in: [bee-js/src/manifest/manifest.ts:108](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/manifest/manifest.ts#L108) ##### Returns `MantarayNode` \| `null` *** ### path #### Get Signature > **get** **path**(): `Uint8Array` Defined in: [bee-js/src/manifest/manifest.ts:100](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/manifest/manifest.ts#L100) ##### Returns `Uint8Array` *** ### selfAddress #### Get Signature > **get** **selfAddress**(): `Uint8Array`\<`ArrayBufferLike`\> \| `null` Defined in: [bee-js/src/manifest/manifest.ts:88](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/manifest/manifest.ts#L88) ##### Returns `Uint8Array`\<`ArrayBufferLike`\> \| `null` *** ### targetAddress #### Get Signature > **get** **targetAddress**(): `Uint8Array` Defined in: [bee-js/src/manifest/manifest.ts:92](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/manifest/manifest.ts#L92) ##### Returns `Uint8Array` *** ### type #### Get Signature > **get** **type**(): `number` \| `null` Defined in: [bee-js/src/manifest/manifest.ts:112](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/manifest/manifest.ts#L112) ##### Returns `number` \| `null` ## Methods ### addFork() > **addFork**(`path`, `reference`, `metadata?`): `void` Defined in: [bee-js/src/manifest/manifest.ts:212](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/manifest/manifest.ts#L212) Adds a fork to the node. #### Parameters ##### path `string` | `Uint8Array`\<`ArrayBufferLike`\> ##### reference `string` | `Uint8Array`\<`ArrayBufferLike`\> | [`Bytes`](Bytes.md) | [`Reference`](Reference.md) ##### metadata? `Record`\<`string`, `string`\> | `null` #### Returns `void` *** ### calculateSelfAddress() > **calculateSelfAddress**(): `Promise`\<[`Reference`](Reference.md)\> Defined in: [bee-js/src/manifest/manifest.ts:230](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/manifest/manifest.ts#L230) Calculates the self address of the node. #### Returns `Promise`\<[`Reference`](Reference.md)\> *** ### collect() > **collect**(`nodes`): `MantarayNode`[] Defined in: [bee-js/src/manifest/manifest.ts:272](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/manifest/manifest.ts#L272) 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](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/manifest/manifest.ts#L281) 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](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/manifest/manifest.ts#L285) #### Returns `number` *** ### find() > **find**(`path`): `MantarayNode` \| `null` Defined in: [bee-js/src/manifest/manifest.ts:256](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/manifest/manifest.ts#L256) 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](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/manifest/manifest.ts#L263) 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](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/manifest/manifest.ts#L140) 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](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/manifest/manifest.ts#L127) 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](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/manifest/manifest.ts#L249) Loads the node and its children recursively. #### Parameters ##### bee [`Bee`](Bee.md) ##### options? [`DownloadOptions`](../interfaces/DownloadOptions.md) ##### requestOptions? [`BeeRequestOptions`](../type-aliases/BeeRequestOptions.md) #### Returns `Promise`\<`void`\> *** ### marshal() > **marshal**(): `Promise`\<`Uint8Array`\<`ArrayBufferLike`\>\> Defined in: [bee-js/src/manifest/manifest.ts:179](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/manifest/manifest.ts#L179) Gets the binary representation of the node. #### Returns `Promise`\<`Uint8Array`\<`ArrayBufferLike`\>\> *** ### removeFork() > **removeFork**(`path`): `void` Defined in: [bee-js/src/manifest/manifest.ts:223](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/manifest/manifest.ts#L223) 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](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/manifest/manifest.ts#L159) Attempts to resolve the manifest as a feed, returning the latest update. #### Parameters ##### bee [`Bee`](Bee.md) ##### requestOptions? [`BeeRequestOptions`](../type-aliases/BeeRequestOptions.md) #### Returns `Promise`\<`Optional`\<`FeedPayloadResult`\>\> *** ### saveRecursively() > **saveRecursively**(`bee`, `postageBatchId`, `options?`, `requestOptions?`): `Promise`\<[`UploadResult`](../interfaces/UploadResult.md)\> Defined in: [bee-js/src/manifest/manifest.ts:237](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/manifest/manifest.ts#L237) Saves the node and its children recursively. #### Parameters ##### bee [`Bee`](Bee.md) ##### postageBatchId `string` | [`BatchId`](BatchId.md) ##### options? [`UploadOptions`](../interfaces/UploadOptions.md) ##### requestOptions? [`BeeRequestOptions`](../type-aliases/BeeRequestOptions.md) #### Returns `Promise`\<[`UploadResult`](../interfaces/UploadResult.md)\> *** ### unmarshal() > `static` **unmarshal**(`bee`, `reference`, `options?`, `requestOptions?`): `Promise`\<`MantarayNode`\> Defined in: [bee-js/src/manifest/manifest.ts:188](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/manifest/manifest.ts#L188) 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`](Bee.md) ##### reference `string` | `Uint8Array`\<`ArrayBufferLike`\> | [`Reference`](Reference.md) ##### options? [`DownloadOptions`](../interfaces/DownloadOptions.md) ##### requestOptions? [`BeeRequestOptions`](../type-aliases/BeeRequestOptions.md) #### Returns `Promise`\<`MantarayNode`\> *** ### unmarshalFromData() > `static` **unmarshalFromData**(`data`, `selfAddress`): `MantarayNode` Defined in: [bee-js/src/manifest/manifest.ts:205](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/manifest/manifest.ts#L205) 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` --- ## Class: Messaging Defined in: [bee-js/src/modules/messaging.ts:41](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/modules/messaging.ts#L41) Messaging protocols — PSS (Postal Service for Swarm) and GSOC. Method names keep their `pss`/`gsoc` prefixes to distinguish the two protocols within the namespace. Accessed as `bee.messaging`. ## Constructors ### Constructor > **new Messaging**(`context`): `Messaging` Defined in: [bee-js/src/modules/messaging.ts:42](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/modules/messaging.ts#L42) #### Parameters ##### context `BeeContext` #### Returns `Messaging` ## Methods ### gsocMine() > **gsocMine**(`targetOverlay`, `identifier`, `proximity`): [`PrivateKey`](../classes/PrivateKey.md) Defined in: [bee-js/src/modules/messaging.ts:154](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/modules/messaging.ts#L154) Mines the signer (a private key) to be used to send GSOC messages to the specific target overlay address. #### Parameters ##### targetOverlay `string` | `Uint8Array`\<`ArrayBufferLike`\> | [`PeerAddress`](../classes/PeerAddress.md) ##### identifier `string` | `Uint8Array`\<`ArrayBufferLike`\> | [`Identifier`](../classes/Identifier.md) ##### proximity `number` = `12` #### Returns [`PrivateKey`](../classes/PrivateKey.md) *** ### gsocSend() > **gsocSend**(`postageBatchId`, `signer`, `identifier`, `data`, `options?`, `requestOptions?`): `Promise`\<[`UploadResult`](../interfaces/UploadResult.md)\> Defined in: [bee-js/src/modules/messaging.ts:189](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/modules/messaging.ts#L189) Sends a GSOC message with the specified signer and identifier. **Warning! Only full nodes can accept GSOC messages.** #### Parameters ##### postageBatchId `string` | `Uint8Array`\<`ArrayBufferLike`\> | [`BatchId`](../classes/BatchId.md) ##### signer `string` | `Uint8Array`\<`ArrayBufferLike`\> | [`PrivateKey`](../classes/PrivateKey.md) ##### identifier `string` | `Uint8Array`\<`ArrayBufferLike`\> | [`Identifier`](../classes/Identifier.md) ##### data `string` | `Uint8Array`\<`ArrayBufferLike`\> ##### options? [`ChunkUploadOptions`](../interfaces/ChunkUploadOptions.md) ##### requestOptions? [`BeeRequestOptions`](../type-aliases/BeeRequestOptions.md) Options for making requests, such as timeouts, custom HTTP agents, headers, etc. #### Returns `Promise`\<[`UploadResult`](../interfaces/UploadResult.md)\> *** ### gsocSubscribe() > **gsocSubscribe**(`address`, `identifier`, `handler`, `options?`): [`GsocSubscription`](../interfaces/GsocSubscription.md) Defined in: [bee-js/src/modules/messaging.ts:217](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/modules/messaging.ts#L217) Subscribes to GSOC messages for the specified owner (of the signer) and identifier. **Warning! Only full nodes can accept GSOC messages.** #### Parameters ##### address `string` | `Uint8Array`\<`ArrayBufferLike`\> | [`EthAddress`](../classes/EthAddress.md) ##### identifier `string` | `Uint8Array`\<`ArrayBufferLike`\> | [`Identifier`](../classes/Identifier.md) ##### handler [`GsocMessageHandler`](../interfaces/GsocMessageHandler.md) ##### options? [`GsocSubscribeOptions`](../interfaces/GsocSubscribeOptions.md) SOC fields to receive and whether to cache the wrapped chunk; requires Bee 2.8.3 or later #### Returns [`GsocSubscription`](../interfaces/GsocSubscription.md) *** ### pssReceive() > **pssReceive**(`topic`, `timeoutMsec`): `Promise`\<[`Bytes`](../classes/Bytes.md)\> Defined in: [bee-js/src/modules/messaging.ts:114](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/modules/messaging.ts#L114) Receives a single message using the Postal Service for Swarm. **Warning! Only full nodes can accept PSS messages.** #### Parameters ##### topic [`Topic`](../classes/Topic.md) Topic name ##### timeoutMsec `number` = `0` Timeout in milliseconds #### Returns `Promise`\<[`Bytes`](../classes/Bytes.md)\> *** ### pssSend() > **pssSend**(`postageBatchId`, `topic`, `target`, `data`, `recipient?`, `requestOptions?`): `Promise`\<`void`\> Defined in: [bee-js/src/modules/messaging.ts:56](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/modules/messaging.ts#L56) Sends data to a recipient or target with the Postal Service for Swarm. **Warning! Only full nodes can accept PSS messages.** #### Parameters ##### postageBatchId Postage BatchId that will be assigned to the sent message. `string` | `Uint8Array`\<`ArrayBufferLike`\> | [`BatchId`](../classes/BatchId.md) ##### topic [`Topic`](../classes/Topic.md) Topic name ##### target `string` Target message address prefix ##### data Message to send `string` | `Uint8Array`\<`ArrayBufferLike`\> ##### recipient? Optional recipient public key `string` | [`PublicKey`](../classes/PublicKey.md) ##### requestOptions? [`BeeRequestOptions`](../type-aliases/BeeRequestOptions.md) Options for making requests, such as timeouts, custom HTTP agents, headers, etc. #### Returns `Promise`\<`void`\> *** ### pssSubscribe() > **pssSubscribe**(`topic`, `handler`): [`PssSubscription`](../interfaces/PssSubscription.md) Defined in: [bee-js/src/modules/messaging.ts:80](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/modules/messaging.ts#L80) Subscribes to messages for the given topic with the Postal Service for Swarm. **Warning! Only full nodes can accept PSS messages.** #### Parameters ##### topic [`Topic`](../classes/Topic.md) Topic name ##### handler [`PssMessageHandler`](../interfaces/PssMessageHandler.md) Message handler interface #### Returns [`PssSubscription`](../interfaces/PssSubscription.md) --- ## Class: PeerAddress Defined in: [core-sdk/src/bytes/peer-address.ts:6](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/peer-address.ts#L6) A 32-byte Swarm overlay (peer) address. ## Extends - [`Bytes`](Bytes.md) ## Constructors ### Constructor > **new PeerAddress**(`bytes`): `PeerAddress` Defined in: [core-sdk/src/bytes/peer-address.ts:9](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/peer-address.ts#L9) #### Parameters ##### bytes `string` | `Uint8Array`\<`ArrayBufferLike`\> | [`Bytes`](Bytes.md) #### Returns `PeerAddress` #### Overrides [`Bytes`](Bytes.md).[`constructor`](Bytes.md#constructor) ## Properties ### length > `readonly` **length**: `number` Defined in: [core-sdk/src/bytes/bytes.ts:19](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L19) #### Inherited from [`Bytes`](Bytes.md).[`length`](Bytes.md#length) *** ### LENGTH > `readonly` `static` **LENGTH**: `32` = `32` Defined in: [core-sdk/src/bytes/peer-address.ts:7](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/peer-address.ts#L7) ## Methods ### equals() > **equals**(`other`): `boolean` Defined in: [core-sdk/src/bytes/bytes.ts:173](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L173) Byte-wise equality against another Bytes instance, raw bytes, or hex string. #### Parameters ##### other `string` | `Uint8Array`\<`ArrayBufferLike`\> | [`Bytes`](Bytes.md) #### Returns `boolean` #### Inherited from [`Bytes`](Bytes.md).[`equals`](Bytes.md#equals) *** ### offset() > **offset**(`index`): `Uint8Array` Defined in: [core-sdk/src/bytes/bytes.ts:110](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L110) Returns a copy of the bytes from `index` to the end. #### Parameters ##### index `number` #### Returns `Uint8Array` #### Inherited from [`Bytes`](Bytes.md).[`offset`](Bytes.md#offset) *** ### parsePayloadAsJson() > **parsePayloadAsJson**(): `unknown` Defined in: [core-sdk/src/bytes/bytes.ts:159](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L159) Parses the bytes as UTF-8 JSON. #### Returns `unknown` #### Inherited from [`Bytes`](Bytes.md).[`parsePayloadAsJson`](Bytes.md#parsepayloadasjson) *** ### represent() > **represent**(): `string` Defined in: [core-sdk/src/bytes/bytes.ts:180](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L180) Human-readable representation, used by debuggers/loggers. Same as [toHex](Bytes.md#tohex). #### Returns `string` #### Inherited from [`Bytes`](Bytes.md).[`represent`](Bytes.md#represent) *** ### toBase32() > **toBase32**(): `string` Defined in: [core-sdk/src/bytes/bytes.ts:138](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L138) Encodes as a padded base32 string. #### Returns `string` #### Inherited from [`Bytes`](Bytes.md).[`toBase32`](Bytes.md#tobase32) *** ### toBase64() > **toBase64**(): `string` Defined in: [core-sdk/src/bytes/bytes.ts:131](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L131) Encodes as a padded base64 string. #### Returns `string` #### Inherited from [`Bytes`](Bytes.md).[`toBase64`](Bytes.md#tobase64) *** ### toHex() > **toHex**(): `string` Defined in: [core-sdk/src/bytes/bytes.ts:124](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L124) Encodes as a lowercase hex string, with no `0x` prefix. #### Returns `string` #### Inherited from [`Bytes`](Bytes.md).[`toHex`](Bytes.md#tohex) *** ### toJSON() > **toJSON**(): `string` Defined in: [core-sdk/src/bytes/bytes.ts:166](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L166) Serialized as its hex string by `JSON.stringify`. #### Returns `string` #### Inherited from [`Bytes`](Bytes.md).[`toJSON`](Bytes.md#tojson) *** ### toString() > **toString**(): `string` Defined in: [core-sdk/src/bytes/bytes.ts:145](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L145) Same as [toHex](Bytes.md#tohex). #### Returns `string` #### Inherited from [`Bytes`](Bytes.md).[`toString`](Bytes.md#tostring) *** ### toUint8Array() > **toUint8Array**(): `Uint8Array` Defined in: [core-sdk/src/bytes/bytes.ts:117](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L117) Returns a copy of the underlying bytes. #### Returns `Uint8Array` #### Inherited from [`Bytes`](Bytes.md).[`toUint8Array`](Bytes.md#touint8array) *** ### toUtf8() > **toUtf8**(): `string` Defined in: [core-sdk/src/bytes/bytes.ts:152](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L152) Decodes the bytes as UTF-8 text. #### Returns `string` #### Inherited from [`Bytes`](Bytes.md).[`toUtf8`](Bytes.md#toutf8) *** ### concat() > `static` **concat**(...`arrays`): `Uint8Array` Defined in: [core-sdk/src/bytes/bytes.ts:75](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L75) Concatenates any number of byte arrays (or Bytes instances) into one new array. #### Parameters ##### arrays ...(`Uint8Array`\<`ArrayBufferLike`\> \| [`Bytes`](Bytes.md))[] #### Returns `Uint8Array` #### Inherited from [`Bytes`](Bytes.md).[`concat`](Bytes.md#concat) *** ### fromSlice() > `static` **fromSlice**(`bytes`, `start`, `length?`): [`Bytes`](Bytes.md) Defined in: [core-sdk/src/bytes/bytes.ts:100](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L100) Wraps a slice of `bytes` starting at `start`, running to the end unless `length` is given. #### Parameters ##### bytes `Uint8Array` ##### start `number` ##### length? `number` #### Returns [`Bytes`](Bytes.md) #### Inherited from [`Bytes`](Bytes.md).[`fromSlice`](Bytes.md#fromslice) *** ### fromUtf8() > `static` **fromUtf8**(`utf8`): [`Bytes`](Bytes.md) Defined in: [core-sdk/src/bytes/bytes.ts:92](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L92) Wraps the UTF-8 encoding of a string. #### Parameters ##### utf8 `string` #### Returns [`Bytes`](Bytes.md) #### Inherited from [`Bytes`](Bytes.md).[`fromUtf8`](Bytes.md#fromutf8) *** ### keccak256() > `static` **keccak256**(`bytes`): [`Bytes`](Bytes.md) Defined in: [core-sdk/src/bytes/bytes.ts:68](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L68) Hashes `bytes` with keccak256 and wraps the 32-byte digest. #### Parameters ##### bytes `string` | `ArrayBuffer` | `Uint8Array`\<`ArrayBufferLike`\> | [`Bytes`](Bytes.md) #### Returns [`Bytes`](Bytes.md) #### Inherited from [`Bytes`](Bytes.md).[`keccak256`](Bytes.md#keccak256) --- ## Class: Pin Defined in: [bee-js/src/modules/pin.ts:12](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/modules/pin.ts#L12) Local pinning operations. Accessed as `bee.pin`. ## Constructors ### Constructor > **new Pin**(`context`): `Pin` Defined in: [bee-js/src/modules/pin.ts:13](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/modules/pin.ts#L13) #### Parameters ##### context `BeeContext` #### Returns `Pin` ## Methods ### add() > **add**(`reference`, `requestOptions?`): `Promise`\<`void`\> Defined in: [bee-js/src/modules/pin.ts:21](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/modules/pin.ts#L21) Pins local data with the given reference. #### Parameters ##### reference Data reference `string` | `Uint8Array`\<`ArrayBufferLike`\> | [`Reference`](../classes/Reference.md) ##### requestOptions? [`BeeRequestOptions`](../type-aliases/BeeRequestOptions.md) Options for making requests, such as timeouts, custom HTTP agents, headers, etc. #### Returns `Promise`\<`void`\> *** ### get() > **get**(`reference`, `requestOptions?`): `Promise`\<[`Pin`](../interfaces/Pin.md)\> Defined in: [bee-js/src/modules/pin.ts:54](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/modules/pin.ts#L54) Gets the pinning status of the chunk with the given reference. #### Parameters ##### reference Data reference `string` | `Uint8Array`\<`ArrayBufferLike`\> | [`Reference`](../classes/Reference.md) ##### requestOptions? [`BeeRequestOptions`](../type-aliases/BeeRequestOptions.md) Options for making requests, such as timeouts, custom HTTP agents, headers, etc. #### Returns `Promise`\<[`Pin`](../interfaces/Pin.md)\> *** ### getAll() > **getAll**(`requestOptions?`): `Promise`\<[`Reference`](../classes/Reference.md)[]\> Defined in: [bee-js/src/modules/pin.ts:44](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/modules/pin.ts#L44) Gets the list of all locally pinned references. #### Parameters ##### requestOptions? [`BeeRequestOptions`](../type-aliases/BeeRequestOptions.md) Options for making requests, such as timeouts, custom HTTP agents, headers, etc. #### Returns `Promise`\<[`Reference`](../classes/Reference.md)[]\> *** ### remove() > **remove**(`reference`, `requestOptions?`): `Promise`\<`void`\> Defined in: [bee-js/src/modules/pin.ts:33](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/modules/pin.ts#L33) Unpins local data with the given reference. #### Parameters ##### reference Data reference `string` | `Uint8Array`\<`ArrayBufferLike`\> | [`Reference`](../classes/Reference.md) ##### requestOptions? [`BeeRequestOptions`](../type-aliases/BeeRequestOptions.md) Options for making requests, such as timeouts, custom HTTP agents, headers, etc. #### Returns `Promise`\<`void`\> *** ### reuploadData() > **reuploadData**(`postageBatchId`, `reference`, `requestOptions?`): `Promise`\<`void`\> Defined in: [bee-js/src/modules/pin.ts:67](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/modules/pin.ts#L67) Instructs the Bee node to reupload locally pinned data into the network. #### Parameters ##### postageBatchId Postage Batch ID that will be used to re-upload the data. `string` | `Uint8Array`\<`ArrayBufferLike`\> | [`BatchId`](../classes/BatchId.md) ##### reference Data reference to be re-uploaded. `string` | `Uint8Array`\<`ArrayBufferLike`\> | [`Reference`](../classes/Reference.md) ##### requestOptions? [`BeeRequestOptions`](../type-aliases/BeeRequestOptions.md) Options for making requests, such as timeouts, custom HTTP agents, headers, etc. #### Returns `Promise`\<`void`\> --- ## Class: PrivateKey Defined in: [core-sdk/src/bytes/private-key.ts:11](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/private-key.ts#L11) A 32-byte secp256k1 private key. ## Extends - [`Bytes`](Bytes.md) ## Constructors ### Constructor > **new PrivateKey**(`bytes`): `PrivateKey` Defined in: [core-sdk/src/bytes/private-key.ts:14](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/private-key.ts#L14) #### Parameters ##### bytes `string` | `Uint8Array`\<`ArrayBufferLike`\> | [`Bytes`](Bytes.md) #### Returns `PrivateKey` #### Overrides [`Bytes`](Bytes.md).[`constructor`](Bytes.md#constructor) ## Properties ### length > `readonly` **length**: `number` Defined in: [core-sdk/src/bytes/bytes.ts:19](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L19) #### Inherited from [`Bytes`](Bytes.md).[`length`](Bytes.md#length) *** ### LENGTH > `readonly` `static` **LENGTH**: `32` = `32` Defined in: [core-sdk/src/bytes/private-key.ts:12](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/private-key.ts#L12) ## Methods ### equals() > **equals**(`other`): `boolean` Defined in: [core-sdk/src/bytes/bytes.ts:173](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L173) Byte-wise equality against another Bytes instance, raw bytes, or hex string. #### Parameters ##### other `string` | `Uint8Array`\<`ArrayBufferLike`\> | [`Bytes`](Bytes.md) #### Returns `boolean` #### Inherited from [`Bytes`](Bytes.md).[`equals`](Bytes.md#equals) *** ### offset() > **offset**(`index`): `Uint8Array` Defined in: [core-sdk/src/bytes/bytes.ts:110](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L110) Returns a copy of the bytes from `index` to the end. #### Parameters ##### index `number` #### Returns `Uint8Array` #### Inherited from [`Bytes`](Bytes.md).[`offset`](Bytes.md#offset) *** ### parsePayloadAsJson() > **parsePayloadAsJson**(): `unknown` Defined in: [core-sdk/src/bytes/bytes.ts:159](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L159) Parses the bytes as UTF-8 JSON. #### Returns `unknown` #### Inherited from [`Bytes`](Bytes.md).[`parsePayloadAsJson`](Bytes.md#parsepayloadasjson) *** ### publicKey() > **publicKey**(): [`PublicKey`](PublicKey.md) Defined in: [core-sdk/src/bytes/private-key.ts:21](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/private-key.ts#L21) Derives the corresponding (uncompressed) public key. #### Returns [`PublicKey`](PublicKey.md) *** ### represent() > **represent**(): `string` Defined in: [core-sdk/src/bytes/bytes.ts:180](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L180) Human-readable representation, used by debuggers/loggers. Same as [toHex](Bytes.md#tohex). #### Returns `string` #### Inherited from [`Bytes`](Bytes.md).[`represent`](Bytes.md#represent) *** ### sign() > **sign**(`data`): [`Signature`](Signature.md) Defined in: [core-sdk/src/bytes/private-key.ts:31](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/private-key.ts#L31) Signs `data` following Ethereum's personal_sign convention (signs keccak256("\x19Ethereum Signed Message:\n32" || keccak256(data))). #### Parameters ##### data `string` | `Uint8Array`\<`ArrayBufferLike`\> #### Returns [`Signature`](Signature.md) *** ### toBase32() > **toBase32**(): `string` Defined in: [core-sdk/src/bytes/bytes.ts:138](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L138) Encodes as a padded base32 string. #### Returns `string` #### Inherited from [`Bytes`](Bytes.md).[`toBase32`](Bytes.md#tobase32) *** ### toBase64() > **toBase64**(): `string` Defined in: [core-sdk/src/bytes/bytes.ts:131](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L131) Encodes as a padded base64 string. #### Returns `string` #### Inherited from [`Bytes`](Bytes.md).[`toBase64`](Bytes.md#tobase64) *** ### toBigInt() > **toBigInt**(): `bigint` Defined in: [core-sdk/src/bytes/private-key.ts:40](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/private-key.ts#L40) Decodes the private key as a bigint scalar, for use in ECDSA operations. #### Returns `bigint` *** ### toHex() > **toHex**(): `string` Defined in: [core-sdk/src/bytes/bytes.ts:124](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L124) Encodes as a lowercase hex string, with no `0x` prefix. #### Returns `string` #### Inherited from [`Bytes`](Bytes.md).[`toHex`](Bytes.md#tohex) *** ### toJSON() > **toJSON**(): `string` Defined in: [core-sdk/src/bytes/bytes.ts:166](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L166) Serialized as its hex string by `JSON.stringify`. #### Returns `string` #### Inherited from [`Bytes`](Bytes.md).[`toJSON`](Bytes.md#tojson) *** ### toString() > **toString**(): `string` Defined in: [core-sdk/src/bytes/bytes.ts:145](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L145) Same as [toHex](Bytes.md#tohex). #### Returns `string` #### Inherited from [`Bytes`](Bytes.md).[`toString`](Bytes.md#tostring) *** ### toUint8Array() > **toUint8Array**(): `Uint8Array` Defined in: [core-sdk/src/bytes/bytes.ts:117](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L117) Returns a copy of the underlying bytes. #### Returns `Uint8Array` #### Inherited from [`Bytes`](Bytes.md).[`toUint8Array`](Bytes.md#touint8array) *** ### toUtf8() > **toUtf8**(): `string` Defined in: [core-sdk/src/bytes/bytes.ts:152](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L152) Decodes the bytes as UTF-8 text. #### Returns `string` #### Inherited from [`Bytes`](Bytes.md).[`toUtf8`](Bytes.md#toutf8) *** ### concat() > `static` **concat**(...`arrays`): `Uint8Array` Defined in: [core-sdk/src/bytes/bytes.ts:75](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L75) Concatenates any number of byte arrays (or Bytes instances) into one new array. #### Parameters ##### arrays ...(`Uint8Array`\<`ArrayBufferLike`\> \| [`Bytes`](Bytes.md))[] #### Returns `Uint8Array` #### Inherited from [`Bytes`](Bytes.md).[`concat`](Bytes.md#concat) *** ### fromSlice() > `static` **fromSlice**(`bytes`, `start`, `length?`): [`Bytes`](Bytes.md) Defined in: [core-sdk/src/bytes/bytes.ts:100](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L100) Wraps a slice of `bytes` starting at `start`, running to the end unless `length` is given. #### Parameters ##### bytes `Uint8Array` ##### start `number` ##### length? `number` #### Returns [`Bytes`](Bytes.md) #### Inherited from [`Bytes`](Bytes.md).[`fromSlice`](Bytes.md#fromslice) *** ### fromUtf8() > `static` **fromUtf8**(`utf8`): [`Bytes`](Bytes.md) Defined in: [core-sdk/src/bytes/bytes.ts:92](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L92) Wraps the UTF-8 encoding of a string. #### Parameters ##### utf8 `string` #### Returns [`Bytes`](Bytes.md) #### Inherited from [`Bytes`](Bytes.md).[`fromUtf8`](Bytes.md#fromutf8) *** ### keccak256() > `static` **keccak256**(`bytes`): [`Bytes`](Bytes.md) Defined in: [core-sdk/src/bytes/bytes.ts:68](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L68) Hashes `bytes` with keccak256 and wraps the 32-byte digest. #### Parameters ##### bytes `string` | `ArrayBuffer` | `Uint8Array`\<`ArrayBufferLike`\> | [`Bytes`](Bytes.md) #### Returns [`Bytes`](Bytes.md) #### Inherited from [`Bytes`](Bytes.md).[`keccak256`](Bytes.md#keccak256) --- ## Class: PublicKey Defined in: [core-sdk/src/bytes/public-key.ts:10](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/public-key.ts#L10) A secp256k1 public key, stored uncompressed (64 bytes: x || y). Also accepts a 33-byte compressed key, decompressing it in the constructor. ## Extends - [`Bytes`](Bytes.md) ## Constructors ### Constructor > **new PublicKey**(`bytes`): `PublicKey` Defined in: [core-sdk/src/bytes/public-key.ts:13](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/public-key.ts#L13) #### Parameters ##### bytes `string` | `Uint8Array`\<`ArrayBufferLike`\> | [`Bytes`](Bytes.md) #### Returns `PublicKey` #### Overrides [`Bytes`](Bytes.md).[`constructor`](Bytes.md#constructor) ## Properties ### length > `readonly` **length**: `number` Defined in: [core-sdk/src/bytes/bytes.ts:19](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L19) #### Inherited from [`Bytes`](Bytes.md).[`length`](Bytes.md#length) *** ### LENGTH > `readonly` `static` **LENGTH**: `64` = `64` Defined in: [core-sdk/src/bytes/public-key.ts:11](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/public-key.ts#L11) ## Methods ### address() > **address**(): [`EthAddress`](EthAddress.md) Defined in: [core-sdk/src/bytes/public-key.ts:28](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/public-key.ts#L28) Derives the corresponding Ethereum address (keccak256 of the uncompressed key, last 20 bytes). #### Returns [`EthAddress`](EthAddress.md) *** ### equals() > **equals**(`other`): `boolean` Defined in: [core-sdk/src/bytes/bytes.ts:173](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L173) Byte-wise equality against another Bytes instance, raw bytes, or hex string. #### Parameters ##### other `string` | `Uint8Array`\<`ArrayBufferLike`\> | [`Bytes`](Bytes.md) #### Returns `boolean` #### Inherited from [`Bytes`](Bytes.md).[`equals`](Bytes.md#equals) *** ### offset() > **offset**(`index`): `Uint8Array` Defined in: [core-sdk/src/bytes/bytes.ts:110](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L110) Returns a copy of the bytes from `index` to the end. #### Parameters ##### index `number` #### Returns `Uint8Array` #### Inherited from [`Bytes`](Bytes.md).[`offset`](Bytes.md#offset) *** ### parsePayloadAsJson() > **parsePayloadAsJson**(): `unknown` Defined in: [core-sdk/src/bytes/bytes.ts:159](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L159) Parses the bytes as UTF-8 JSON. #### Returns `unknown` #### Inherited from [`Bytes`](Bytes.md).[`parsePayloadAsJson`](Bytes.md#parsepayloadasjson) *** ### represent() > **represent**(): `string` Defined in: [core-sdk/src/bytes/bytes.ts:180](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L180) Human-readable representation, used by debuggers/loggers. Same as [toHex](Bytes.md#tohex). #### Returns `string` #### Inherited from [`Bytes`](Bytes.md).[`represent`](Bytes.md#represent) *** ### toBase32() > **toBase32**(): `string` Defined in: [core-sdk/src/bytes/bytes.ts:138](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L138) Encodes as a padded base32 string. #### Returns `string` #### Inherited from [`Bytes`](Bytes.md).[`toBase32`](Bytes.md#tobase32) *** ### toBase64() > **toBase64**(): `string` Defined in: [core-sdk/src/bytes/bytes.ts:131](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L131) Encodes as a padded base64 string. #### Returns `string` #### Inherited from [`Bytes`](Bytes.md).[`toBase64`](Bytes.md#tobase64) *** ### toCompressedHex() > **toCompressedHex**(): `string` Defined in: [core-sdk/src/bytes/public-key.ts:48](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/public-key.ts#L48) Hex encoding of [toCompressedUint8Array](#tocompresseduint8array). #### Returns `string` *** ### toCompressedUint8Array() > **toCompressedUint8Array**(): `Uint8Array` Defined in: [core-sdk/src/bytes/public-key.ts:38](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/public-key.ts#L38) Encodes as a 33-byte compressed key (0x02/0x03 prefix || x). #### Returns `Uint8Array` *** ### toHex() > **toHex**(): `string` Defined in: [core-sdk/src/bytes/bytes.ts:124](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L124) Encodes as a lowercase hex string, with no `0x` prefix. #### Returns `string` #### Inherited from [`Bytes`](Bytes.md).[`toHex`](Bytes.md#tohex) *** ### toJSON() > **toJSON**(): `string` Defined in: [core-sdk/src/bytes/bytes.ts:166](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L166) Serialized as its hex string by `JSON.stringify`. #### Returns `string` #### Inherited from [`Bytes`](Bytes.md).[`toJSON`](Bytes.md#tojson) *** ### toString() > **toString**(): `string` Defined in: [core-sdk/src/bytes/bytes.ts:145](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L145) Same as [toHex](Bytes.md#tohex). #### Returns `string` #### Inherited from [`Bytes`](Bytes.md).[`toString`](Bytes.md#tostring) *** ### toUint8Array() > **toUint8Array**(): `Uint8Array` Defined in: [core-sdk/src/bytes/bytes.ts:117](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L117) Returns a copy of the underlying bytes. #### Returns `Uint8Array` #### Inherited from [`Bytes`](Bytes.md).[`toUint8Array`](Bytes.md#touint8array) *** ### toUtf8() > **toUtf8**(): `string` Defined in: [core-sdk/src/bytes/bytes.ts:152](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L152) Decodes the bytes as UTF-8 text. #### Returns `string` #### Inherited from [`Bytes`](Bytes.md).[`toUtf8`](Bytes.md#toutf8) *** ### concat() > `static` **concat**(...`arrays`): `Uint8Array` Defined in: [core-sdk/src/bytes/bytes.ts:75](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L75) Concatenates any number of byte arrays (or Bytes instances) into one new array. #### Parameters ##### arrays ...(`Uint8Array`\<`ArrayBufferLike`\> \| [`Bytes`](Bytes.md))[] #### Returns `Uint8Array` #### Inherited from [`Bytes`](Bytes.md).[`concat`](Bytes.md#concat) *** ### fromSlice() > `static` **fromSlice**(`bytes`, `start`, `length?`): [`Bytes`](Bytes.md) Defined in: [core-sdk/src/bytes/bytes.ts:100](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L100) Wraps a slice of `bytes` starting at `start`, running to the end unless `length` is given. #### Parameters ##### bytes `Uint8Array` ##### start `number` ##### length? `number` #### Returns [`Bytes`](Bytes.md) #### Inherited from [`Bytes`](Bytes.md).[`fromSlice`](Bytes.md#fromslice) *** ### fromUtf8() > `static` **fromUtf8**(`utf8`): [`Bytes`](Bytes.md) Defined in: [core-sdk/src/bytes/bytes.ts:92](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L92) Wraps the UTF-8 encoding of a string. #### Parameters ##### utf8 `string` #### Returns [`Bytes`](Bytes.md) #### Inherited from [`Bytes`](Bytes.md).[`fromUtf8`](Bytes.md#fromutf8) *** ### keccak256() > `static` **keccak256**(`bytes`): [`Bytes`](Bytes.md) Defined in: [core-sdk/src/bytes/bytes.ts:68](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L68) Hashes `bytes` with keccak256 and wraps the 32-byte digest. #### Parameters ##### bytes `string` | `ArrayBuffer` | `Uint8Array`\<`ArrayBufferLike`\> | [`Bytes`](Bytes.md) #### Returns [`Bytes`](Bytes.md) #### Inherited from [`Bytes`](Bytes.md).[`keccak256`](Bytes.md#keccak256) --- ## Class: Reference Defined in: [core-sdk/src/bytes/reference.ts:27](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/reference.ts#L27) A Swarm chunk/manifest reference: 32 bytes for an unencrypted address, or 64 bytes (address || decryption key) for an encrypted one. Also accepts a `"bah5..."` CID string, decoding it to the underlying reference bytes. ## Extends - [`Bytes`](Bytes.md) ## Constructors ### Constructor > **new Reference**(`bytes`): `Reference` Defined in: [core-sdk/src/bytes/reference.ts:30](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/reference.ts#L30) #### Parameters ##### bytes `string` | `Uint8Array`\<`ArrayBufferLike`\> | [`Bytes`](Bytes.md) #### Returns `Reference` #### Overrides [`Bytes`](Bytes.md).[`constructor`](Bytes.md#constructor) ## Properties ### length > `readonly` **length**: `number` Defined in: [core-sdk/src/bytes/bytes.ts:19](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L19) #### Inherited from [`Bytes`](Bytes.md).[`length`](Bytes.md#length) *** ### LENGTH > `readonly` `static` **LENGTH**: `32` = `32` Defined in: [core-sdk/src/bytes/reference.ts:28](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/reference.ts#L28) ## Methods ### equals() > **equals**(`other`): `boolean` Defined in: [core-sdk/src/bytes/bytes.ts:173](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L173) Byte-wise equality against another Bytes instance, raw bytes, or hex string. #### Parameters ##### other `string` | `Uint8Array`\<`ArrayBufferLike`\> | [`Bytes`](Bytes.md) #### Returns `boolean` #### Inherited from [`Bytes`](Bytes.md).[`equals`](Bytes.md#equals) *** ### offset() > **offset**(`index`): `Uint8Array` Defined in: [core-sdk/src/bytes/bytes.ts:110](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L110) Returns a copy of the bytes from `index` to the end. #### Parameters ##### index `number` #### Returns `Uint8Array` #### Inherited from [`Bytes`](Bytes.md).[`offset`](Bytes.md#offset) *** ### parsePayloadAsJson() > **parsePayloadAsJson**(): `unknown` Defined in: [core-sdk/src/bytes/bytes.ts:159](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L159) Parses the bytes as UTF-8 JSON. #### Returns `unknown` #### Inherited from [`Bytes`](Bytes.md).[`parsePayloadAsJson`](Bytes.md#parsepayloadasjson) *** ### represent() > **represent**(): `string` Defined in: [core-sdk/src/bytes/bytes.ts:180](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L180) Human-readable representation, used by debuggers/loggers. Same as [toHex](Bytes.md#tohex). #### Returns `string` #### Inherited from [`Bytes`](Bytes.md).[`represent`](Bytes.md#represent) *** ### toBase32() > **toBase32**(): `string` Defined in: [core-sdk/src/bytes/bytes.ts:138](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L138) Encodes as a padded base32 string. #### Returns `string` #### Inherited from [`Bytes`](Bytes.md).[`toBase32`](Bytes.md#tobase32) *** ### toBase64() > **toBase64**(): `string` Defined in: [core-sdk/src/bytes/bytes.ts:131](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L131) Encodes as a padded base64 string. #### Returns `string` #### Inherited from [`Bytes`](Bytes.md).[`toBase64`](Bytes.md#tobase64) *** ### toCid() > **toCid**(`type`): `string` Defined in: [core-sdk/src/bytes/reference.ts:41](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/reference.ts#L41) Encodes the reference as a `"bah5..."` CID string of the given type. #### Parameters ##### type `"manifest"` | `"feed"` #### Returns `string` *** ### toHex() > **toHex**(): `string` Defined in: [core-sdk/src/bytes/bytes.ts:124](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L124) Encodes as a lowercase hex string, with no `0x` prefix. #### Returns `string` #### Inherited from [`Bytes`](Bytes.md).[`toHex`](Bytes.md#tohex) *** ### toJSON() > **toJSON**(): `string` Defined in: [core-sdk/src/bytes/bytes.ts:166](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L166) Serialized as its hex string by `JSON.stringify`. #### Returns `string` #### Inherited from [`Bytes`](Bytes.md).[`toJSON`](Bytes.md#tojson) *** ### toString() > **toString**(): `string` Defined in: [core-sdk/src/bytes/bytes.ts:145](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L145) Same as [toHex](Bytes.md#tohex). #### Returns `string` #### Inherited from [`Bytes`](Bytes.md).[`toString`](Bytes.md#tostring) *** ### toUint8Array() > **toUint8Array**(): `Uint8Array` Defined in: [core-sdk/src/bytes/bytes.ts:117](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L117) Returns a copy of the underlying bytes. #### Returns `Uint8Array` #### Inherited from [`Bytes`](Bytes.md).[`toUint8Array`](Bytes.md#touint8array) *** ### toUtf8() > **toUtf8**(): `string` Defined in: [core-sdk/src/bytes/bytes.ts:152](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L152) Decodes the bytes as UTF-8 text. #### Returns `string` #### Inherited from [`Bytes`](Bytes.md).[`toUtf8`](Bytes.md#toutf8) *** ### concat() > `static` **concat**(...`arrays`): `Uint8Array` Defined in: [core-sdk/src/bytes/bytes.ts:75](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L75) Concatenates any number of byte arrays (or Bytes instances) into one new array. #### Parameters ##### arrays ...(`Uint8Array`\<`ArrayBufferLike`\> \| [`Bytes`](Bytes.md))[] #### Returns `Uint8Array` #### Inherited from [`Bytes`](Bytes.md).[`concat`](Bytes.md#concat) *** ### fromSlice() > `static` **fromSlice**(`bytes`, `start`, `length?`): [`Bytes`](Bytes.md) Defined in: [core-sdk/src/bytes/bytes.ts:100](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L100) Wraps a slice of `bytes` starting at `start`, running to the end unless `length` is given. #### Parameters ##### bytes `Uint8Array` ##### start `number` ##### length? `number` #### Returns [`Bytes`](Bytes.md) #### Inherited from [`Bytes`](Bytes.md).[`fromSlice`](Bytes.md#fromslice) *** ### fromUtf8() > `static` **fromUtf8**(`utf8`): [`Bytes`](Bytes.md) Defined in: [core-sdk/src/bytes/bytes.ts:92](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L92) Wraps the UTF-8 encoding of a string. #### Parameters ##### utf8 `string` #### Returns [`Bytes`](Bytes.md) #### Inherited from [`Bytes`](Bytes.md).[`fromUtf8`](Bytes.md#fromutf8) *** ### isValid() > `static` **isValid**(`value`): `boolean` Defined in: [core-sdk/src/bytes/reference.ts:61](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/reference.ts#L61) Returns whether `value` parses as a valid Reference (raw hex, 32/64-byte bytes, or a `"bah5..."` CID string). #### Parameters ##### value `string` #### Returns `boolean` *** ### keccak256() > `static` **keccak256**(`bytes`): [`Bytes`](Bytes.md) Defined in: [core-sdk/src/bytes/bytes.ts:68](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L68) Hashes `bytes` with keccak256 and wraps the 32-byte digest. #### Parameters ##### bytes `string` | `ArrayBuffer` | `Uint8Array`\<`ArrayBufferLike`\> | [`Bytes`](Bytes.md) #### Returns [`Bytes`](Bytes.md) #### Inherited from [`Bytes`](Bytes.md).[`keccak256`](Bytes.md#keccak256) --- ## Class: RollingFeed Defined in: [bee-js/src/modules/rolling-feed.ts:69](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/modules/rolling-feed.ts#L69) ## Constructors ### Constructor > **new RollingFeed**(`context`): `RollingFeed` Defined in: [bee-js/src/modules/rolling-feed.ts:70](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/modules/rolling-feed.ts#L70) #### Parameters ##### context `BeeContext` #### Returns `RollingFeed` ## Methods ### makeReader() > **makeReader**(`baseTopic`, `owner`, `periodLength`): [`RollingFeedReader`](RollingFeedReader.md) Defined in: [bee-js/src/modules/rolling-feed.ts:76](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/modules/rolling-feed.ts#L76) #### Parameters ##### baseTopic [`Topic`](../classes/Topic.md) ##### owner [`EthAddress`](../classes/EthAddress.md) ##### periodLength `number` #### Returns [`RollingFeedReader`](RollingFeedReader.md) *** ### makeWriter() > **makeWriter**(`baseTopic`, `signer`, `periodLength`): [`RollingFeedWriter`](RollingFeedWriter.md) Defined in: [bee-js/src/modules/rolling-feed.ts:72](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/modules/rolling-feed.ts#L72) #### Parameters ##### baseTopic [`Topic`](../classes/Topic.md) ##### signer [`PrivateKey`](../classes/PrivateKey.md) ##### periodLength `number` #### Returns [`RollingFeedWriter`](RollingFeedWriter.md) --- ## Class: RollingFeedReader Defined in: [bee-js/src/modules/rolling-feed.ts:211](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/modules/rolling-feed.ts#L211) ## Constructors ### Constructor > **new RollingFeedReader**(`context`, `baseTopic`, `owner`, `periodLength`): `RollingFeedReader` Defined in: [bee-js/src/modules/rolling-feed.ts:212](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/modules/rolling-feed.ts#L212) #### Parameters ##### context `BeeContext` ##### baseTopic [`Topic`](../classes/Topic.md) ##### owner [`EthAddress`](../classes/EthAddress.md) ##### periodLength `number` #### Returns `RollingFeedReader` ## Methods ### downloadPayload() > **downloadPayload**(`options?`): `Promise`\<`FeedPayloadResult`\> Defined in: [bee-js/src/modules/rolling-feed.ts:223](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/modules/rolling-feed.ts#L223) Reads the current period's feed; falls back to the previous period once if empty, to tolerate clock skew between writer and reader. #### Parameters ##### options? `Omit`\<`FeedUpdateOptions`, `"index"`\> #### Returns `Promise`\<`FeedPayloadResult`\> *** ### downloadReference() > **downloadReference**(): `Promise`\<`FeedReferenceResult`\> Defined in: [bee-js/src/modules/rolling-feed.ts:241](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/modules/rolling-feed.ts#L241) Same as `downloadPayload`, but for a reference to data uploaded elsewhere. #### Returns `Promise`\<`FeedReferenceResult`\> --- ## Class: RollingFeedWriter Defined in: [bee-js/src/modules/rolling-feed.ts:81](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/modules/rolling-feed.ts#L81) ## Constructors ### Constructor > **new RollingFeedWriter**(`context`, `baseTopic`, `signer`, `periodLength`): `RollingFeedWriter` Defined in: [bee-js/src/modules/rolling-feed.ts:82](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/modules/rolling-feed.ts#L82) #### Parameters ##### context `BeeContext` ##### baseTopic [`Topic`](../classes/Topic.md) ##### signer [`PrivateKey`](../classes/PrivateKey.md) ##### periodLength `number` #### Returns `RollingFeedWriter` ## Methods ### catchUp() > **catchUp**(`postageBatchId`, `periodIdx?`, `maxBackfill?`): `Promise`\<`void`\> Defined in: [bee-js/src/modules/rolling-feed.ts:148](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/modules/rolling-feed.ts#L148) Backfills up to `maxBackfill` periods strictly between the last populated one and `periodIdx` (default: current) with that period's last known payload/reference. Never writes `periodIdx` itself - keeping it populated during silence is the caller's job (a periodic `uploadPayload`/`uploadReference` heartbeat), not catchUp's. A conditional "write it if empty" would race that heartbeat: there's no compare-and-swap on a SOC address, so a stale write can still land after a concurrent fresh one and shadow it. `maxBackfill` bounds both the backward scan and the backfill itself, since scanning further back than you're willing to backfill only wastes round trips. Defaults to 1, matching the reader's one-period fallback - nothing deeper is ever read anyway. Throws if no populated period is found within that bound. #### Parameters ##### postageBatchId `string` | [`BatchId`](../classes/BatchId.md) ##### periodIdx? `number` ##### maxBackfill? `number` = `DEFAULT_MAX_BACKFILL` #### Returns `Promise`\<`void`\> *** ### isCaughtUp() > **isCaughtUp**(`periodIdx?`): `Promise`\<`boolean`\> Defined in: [bee-js/src/modules/rolling-feed.ts:127](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/modules/rolling-feed.ts#L127) True unless the period right before `periodIdx` (default: current) never got mirrored forward into it, i.e. the writer went silent for at least one whole period. #### Parameters ##### periodIdx? `number` #### Returns `Promise`\<`boolean`\> *** ### uploadPayload() > **uploadPayload**(`postageBatchId`, `payload`, `options?`): `Promise`\<[`UploadResult`](../interfaces/UploadResult.md)\> Defined in: [bee-js/src/modules/rolling-feed.ts:89](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/modules/rolling-feed.ts#L89) #### Parameters ##### postageBatchId `string` | [`BatchId`](../classes/BatchId.md) ##### payload `string` | `Uint8Array`\<`ArrayBufferLike`\> ##### options? `FeedUploadOptions` #### Returns `Promise`\<[`UploadResult`](../interfaces/UploadResult.md)\> *** ### uploadReference() > **uploadReference**(`postageBatchId`, `reference`, `options?`): `Promise`\<[`UploadResult`](../interfaces/UploadResult.md)\> Defined in: [bee-js/src/modules/rolling-feed.ts:106](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/modules/rolling-feed.ts#L106) #### Parameters ##### postageBatchId `string` | [`BatchId`](../classes/BatchId.md) ##### reference `string` | `Uint8Array`\<`ArrayBufferLike`\> | [`Reference`](../classes/Reference.md) ##### options? `FeedUploadOptions` #### Returns `Promise`\<[`UploadResult`](../interfaces/UploadResult.md)\> --- ## Class: Settlement Defined in: [bee-js/src/modules/settlement.ts:11](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/modules/settlement.ts#L11) Settlement operations. Related to the bandwidth incentives and the chequebook. Accessed as `bee.settlement`. ## Constructors ### Constructor > **new Settlement**(`context`): `Settlement` Defined in: [bee-js/src/modules/settlement.ts:12](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/modules/settlement.ts#L12) #### Parameters ##### context `BeeContext` #### Returns `Settlement` ## Methods ### get() > **get**(`address`, `requestOptions?`): `Promise`\<[`Settlements`](../interfaces/Settlements.md)\> Defined in: [bee-js/src/modules/settlement.ts:20](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/modules/settlement.ts#L20) Gets the amount of sent and received micropayments from settlements with a peer. #### Parameters ##### address Swarm address of peer `string` | [`PeerAddress`](../classes/PeerAddress.md) ##### requestOptions? [`BeeRequestOptions`](../type-aliases/BeeRequestOptions.md) Options for making requests, such as timeouts, custom HTTP agents, headers, etc. #### Returns `Promise`\<[`Settlements`](../interfaces/Settlements.md)\> *** ### getAll() > **getAll**(`requestOptions?`): `Promise`\<[`AllSettlements`](../interfaces/AllSettlements.md)\> Defined in: [bee-js/src/modules/settlement.ts:31](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/modules/settlement.ts#L31) Gets settlements with all known peers and total amount sent or received. #### Parameters ##### requestOptions? [`BeeRequestOptions`](../type-aliases/BeeRequestOptions.md) Options for making requests, such as timeouts, custom HTTP agents, headers, etc. #### Returns `Promise`\<[`AllSettlements`](../interfaces/AllSettlements.md)\> --- ## Class: Signature Defined in: [core-sdk/src/bytes/signature.ts:26](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/signature.ts#L26) A 65-byte ECDSA signature (r || s || v), as produced by [PrivateKey.sign](PrivateKey.md#sign). ## Extends - [`Bytes`](Bytes.md) ## Constructors ### Constructor > **new Signature**(`bytes`): `Signature` Defined in: [core-sdk/src/bytes/signature.ts:29](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/signature.ts#L29) #### Parameters ##### bytes `string` | `Uint8Array`\<`ArrayBufferLike`\> | [`Bytes`](Bytes.md) #### Returns `Signature` #### Overrides [`Bytes`](Bytes.md).[`constructor`](Bytes.md#constructor) ## Properties ### length > `readonly` **length**: `number` Defined in: [core-sdk/src/bytes/bytes.ts:19](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L19) #### Inherited from [`Bytes`](Bytes.md).[`length`](Bytes.md#length) *** ### LENGTH > `readonly` `static` **LENGTH**: `65` = `65` Defined in: [core-sdk/src/bytes/signature.ts:27](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/signature.ts#L27) ## Methods ### equals() > **equals**(`other`): `boolean` Defined in: [core-sdk/src/bytes/bytes.ts:173](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L173) Byte-wise equality against another Bytes instance, raw bytes, or hex string. #### Parameters ##### other `string` | `Uint8Array`\<`ArrayBufferLike`\> | [`Bytes`](Bytes.md) #### Returns `boolean` #### Inherited from [`Bytes`](Bytes.md).[`equals`](Bytes.md#equals) *** ### isValid() > **isValid**(`digest`, `expectedAddress`): `boolean` Defined in: [core-sdk/src/bytes/signature.ts:57](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/signature.ts#L57) Returns whether this signature over `digest` was produced by the owner of `expectedAddress`. #### Parameters ##### digest `string` | `Uint8Array`\<`ArrayBufferLike`\> ##### expectedAddress `string` | `Uint8Array`\<`ArrayBufferLike`\> | [`EthAddress`](EthAddress.md) #### Returns `boolean` *** ### offset() > **offset**(`index`): `Uint8Array` Defined in: [core-sdk/src/bytes/bytes.ts:110](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L110) Returns a copy of the bytes from `index` to the end. #### Parameters ##### index `number` #### Returns `Uint8Array` #### Inherited from [`Bytes`](Bytes.md).[`offset`](Bytes.md#offset) *** ### parsePayloadAsJson() > **parsePayloadAsJson**(): `unknown` Defined in: [core-sdk/src/bytes/bytes.ts:159](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L159) Parses the bytes as UTF-8 JSON. #### Returns `unknown` #### Inherited from [`Bytes`](Bytes.md).[`parsePayloadAsJson`](Bytes.md#parsepayloadasjson) *** ### recoverPublicKey() > **recoverPublicKey**(`digest`): [`PublicKey`](PublicKey.md) Defined in: [core-sdk/src/bytes/signature.ts:44](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/signature.ts#L44) Recovers the public key that produced this signature over `digest`, following the same personal_sign convention as [PrivateKey.sign](PrivateKey.md#sign). #### Parameters ##### digest `string` | `Uint8Array`\<`ArrayBufferLike`\> #### Returns [`PublicKey`](PublicKey.md) *** ### represent() > **represent**(): `string` Defined in: [core-sdk/src/bytes/bytes.ts:180](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L180) Human-readable representation, used by debuggers/loggers. Same as [toHex](Bytes.md#tohex). #### Returns `string` #### Inherited from [`Bytes`](Bytes.md).[`represent`](Bytes.md#represent) *** ### toBase32() > **toBase32**(): `string` Defined in: [core-sdk/src/bytes/bytes.ts:138](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L138) Encodes as a padded base32 string. #### Returns `string` #### Inherited from [`Bytes`](Bytes.md).[`toBase32`](Bytes.md#tobase32) *** ### toBase64() > **toBase64**(): `string` Defined in: [core-sdk/src/bytes/bytes.ts:131](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L131) Encodes as a padded base64 string. #### Returns `string` #### Inherited from [`Bytes`](Bytes.md).[`toBase64`](Bytes.md#tobase64) *** ### toHex() > **toHex**(): `string` Defined in: [core-sdk/src/bytes/bytes.ts:124](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L124) Encodes as a lowercase hex string, with no `0x` prefix. #### Returns `string` #### Inherited from [`Bytes`](Bytes.md).[`toHex`](Bytes.md#tohex) *** ### toJSON() > **toJSON**(): `string` Defined in: [core-sdk/src/bytes/bytes.ts:166](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L166) Serialized as its hex string by `JSON.stringify`. #### Returns `string` #### Inherited from [`Bytes`](Bytes.md).[`toJSON`](Bytes.md#tojson) *** ### toString() > **toString**(): `string` Defined in: [core-sdk/src/bytes/bytes.ts:145](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L145) Same as [toHex](Bytes.md#tohex). #### Returns `string` #### Inherited from [`Bytes`](Bytes.md).[`toString`](Bytes.md#tostring) *** ### toUint8Array() > **toUint8Array**(): `Uint8Array` Defined in: [core-sdk/src/bytes/bytes.ts:117](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L117) Returns a copy of the underlying bytes. #### Returns `Uint8Array` #### Inherited from [`Bytes`](Bytes.md).[`toUint8Array`](Bytes.md#touint8array) *** ### toUtf8() > **toUtf8**(): `string` Defined in: [core-sdk/src/bytes/bytes.ts:152](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L152) Decodes the bytes as UTF-8 text. #### Returns `string` #### Inherited from [`Bytes`](Bytes.md).[`toUtf8`](Bytes.md#toutf8) *** ### concat() > `static` **concat**(...`arrays`): `Uint8Array` Defined in: [core-sdk/src/bytes/bytes.ts:75](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L75) Concatenates any number of byte arrays (or Bytes instances) into one new array. #### Parameters ##### arrays ...(`Uint8Array`\<`ArrayBufferLike`\> \| [`Bytes`](Bytes.md))[] #### Returns `Uint8Array` #### Inherited from [`Bytes`](Bytes.md).[`concat`](Bytes.md#concat) *** ### fromSlice() > `static` **fromSlice**(`bytes`, `start`): `Signature` Defined in: [core-sdk/src/bytes/signature.ts:36](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/signature.ts#L36) Reads a 65-byte Signature out of a larger buffer, starting at `start`. #### Parameters ##### bytes `Uint8Array` ##### start `number` #### Returns `Signature` #### Overrides [`Bytes`](Bytes.md).[`fromSlice`](Bytes.md#fromslice) *** ### fromUtf8() > `static` **fromUtf8**(`utf8`): [`Bytes`](Bytes.md) Defined in: [core-sdk/src/bytes/bytes.ts:92](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L92) Wraps the UTF-8 encoding of a string. #### Parameters ##### utf8 `string` #### Returns [`Bytes`](Bytes.md) #### Inherited from [`Bytes`](Bytes.md).[`fromUtf8`](Bytes.md#fromutf8) *** ### keccak256() > `static` **keccak256**(`bytes`): [`Bytes`](Bytes.md) Defined in: [core-sdk/src/bytes/bytes.ts:68](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L68) Hashes `bytes` with keccak256 and wraps the 32-byte digest. #### Parameters ##### bytes `string` | `ArrayBuffer` | `Uint8Array`\<`ArrayBufferLike`\> | [`Bytes`](Bytes.md) #### Returns [`Bytes`](Bytes.md) #### Inherited from [`Bytes`](Bytes.md).[`keccak256`](Bytes.md#keccak256) --- ## Class: Size Defined in: [bee-js/src/utils/size.ts:10](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/utils/size.ts#L10) Represents a size in bytes. Uses 1000 instead of 1024 for converting between units. This is to stay consistent with the Swarm papers on theoretical and effective storage capacity. ## Methods ### represent() > **represent**(): `string` Defined in: [bee-js/src/utils/size.ts:75](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/utils/size.ts#L75) #### Returns `string` *** ### toBytes() > **toBytes**(): `number` Defined in: [bee-js/src/utils/size.ts:63](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/utils/size.ts#L63) #### Returns `number` *** ### toFormattedString() > **toFormattedString**(): `string` Defined in: [bee-js/src/utils/size.ts:71](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/utils/size.ts#L71) #### Returns `string` *** ### toGigabytes() > **toGigabytes**(): `number` Defined in: [bee-js/src/utils/size.ts:67](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/utils/size.ts#L67) #### Returns `number` *** ### fromBytes() > `static` **fromBytes**(`bytes`): `Size` Defined in: [bee-js/src/utils/size.ts:21](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/utils/size.ts#L21) #### Parameters ##### bytes `number` #### Returns `Size` *** ### fromGigabytes() > `static` **fromGigabytes**(`gigabytes`): `Size` Defined in: [bee-js/src/utils/size.ts:33](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/utils/size.ts#L33) #### Parameters ##### gigabytes `number` #### Returns `Size` *** ### fromKilobytes() > `static` **fromKilobytes**(`kilobytes`): `Size` Defined in: [bee-js/src/utils/size.ts:25](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/utils/size.ts#L25) #### Parameters ##### kilobytes `number` #### Returns `Size` *** ### fromMegabytes() > `static` **fromMegabytes**(`megabytes`): `Size` Defined in: [bee-js/src/utils/size.ts:29](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/utils/size.ts#L29) #### Parameters ##### megabytes `number` #### Returns `Size` *** ### parseFromString() > `static` **parseFromString**(`size`): `Size` Defined in: [bee-js/src/utils/size.ts:59](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/utils/size.ts#L59) Parses a size string and returns a `Size` instance. Case insensitive. E.g. both `"28MB"` and `"1gb"` are valid. Whitespaces are ignored. E.g. both `"512 kb"` and `"2megabytes"` are valid. Decimal numbers are supported. E.g. `"1.5gb"` is valid. Uses 1000 as the base for conversions. E.g. 1kb = 1000 bytes. This is consistent with the effective stamp utilization table. Supported units: - b, byte, bytes - kb, kilobyte, kilobytes - mb, megabyte, megabytes - gb, gigabyte, gigabytes - tb, terabyte, terabytes #### Parameters ##### size `string` A string representing a size #### Returns `Size` a `Size` instance --- ## Class: Soc Defined in: [bee-js/src/modules/soc.ts:11](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/modules/soc.ts#L11) Single owner chunk (SOC) reader/writer operations. Accessed as `bee.soc`. ## Constructors ### Constructor > **new Soc**(`context`): `Soc` Defined in: [bee-js/src/modules/soc.ts:12](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/modules/soc.ts#L12) #### Parameters ##### context `BeeContext` #### Returns `Soc` ## Methods ### makeReader() > **makeReader**(`ownerAddress`, `requestOptions?`): [`SOCReader`](../interfaces/SOCReader.md) Defined in: [bee-js/src/modules/soc.ts:20](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/modules/soc.ts#L20) Returns an object for reading single owner chunks. #### Parameters ##### ownerAddress The ethereum address of the owner `string` | `Uint8Array`\<`ArrayBufferLike`\> | [`EthAddress`](../classes/EthAddress.md) ##### requestOptions? [`BeeRequestOptions`](../type-aliases/BeeRequestOptions.md) Options for making requests, such as timeouts, custom HTTP agents, headers, etc. #### Returns [`SOCReader`](../interfaces/SOCReader.md) *** ### makeWriter() > **makeWriter**(`signer?`, `requestOptions?`): [`SOCWriter`](../interfaces/SOCWriter.md) Defined in: [bee-js/src/modules/soc.ts:35](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/modules/soc.ts#L35) Returns an object for reading and writing single owner chunks. #### Parameters ##### signer? The signer's private key. Falls back to the Bee instance signer. `string` | `Uint8Array`\<`ArrayBufferLike`\> | [`PrivateKey`](../classes/PrivateKey.md) ##### requestOptions? [`BeeRequestOptions`](../type-aliases/BeeRequestOptions.md) Options for making requests, such as timeouts, custom HTTP agents, headers, etc. #### Returns [`SOCWriter`](../interfaces/SOCWriter.md) --- ## Class: Span Defined in: [core-sdk/src/bytes/span.ts:7](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/span.ts#L7) An 8-byte, little-endian span - the byte count prefixing a chunk's payload. ## Extends - [`Bytes`](Bytes.md) ## Constructors ### Constructor > **new Span**(`bytes`): `Span` Defined in: [core-sdk/src/bytes/span.ts:10](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/span.ts#L10) #### Parameters ##### bytes `string` | `Uint8Array`\<`ArrayBufferLike`\> | [`Bytes`](Bytes.md) #### Returns `Span` #### Overrides [`Bytes`](Bytes.md).[`constructor`](Bytes.md#constructor) ## Properties ### length > `readonly` **length**: `number` Defined in: [core-sdk/src/bytes/bytes.ts:19](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L19) #### Inherited from [`Bytes`](Bytes.md).[`length`](Bytes.md#length) *** ### LENGTH > `readonly` `static` **LENGTH**: `8` = `8` Defined in: [core-sdk/src/bytes/span.ts:8](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/span.ts#L8) ## Methods ### equals() > **equals**(`other`): `boolean` Defined in: [core-sdk/src/bytes/bytes.ts:173](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L173) Byte-wise equality against another Bytes instance, raw bytes, or hex string. #### Parameters ##### other `string` | `Uint8Array`\<`ArrayBufferLike`\> | [`Bytes`](Bytes.md) #### Returns `boolean` #### Inherited from [`Bytes`](Bytes.md).[`equals`](Bytes.md#equals) *** ### offset() > **offset**(`index`): `Uint8Array` Defined in: [core-sdk/src/bytes/bytes.ts:110](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L110) Returns a copy of the bytes from `index` to the end. #### Parameters ##### index `number` #### Returns `Uint8Array` #### Inherited from [`Bytes`](Bytes.md).[`offset`](Bytes.md#offset) *** ### parsePayloadAsJson() > **parsePayloadAsJson**(): `unknown` Defined in: [core-sdk/src/bytes/bytes.ts:159](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L159) Parses the bytes as UTF-8 JSON. #### Returns `unknown` #### Inherited from [`Bytes`](Bytes.md).[`parsePayloadAsJson`](Bytes.md#parsepayloadasjson) *** ### represent() > **represent**(): `string` Defined in: [core-sdk/src/bytes/bytes.ts:180](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L180) Human-readable representation, used by debuggers/loggers. Same as [toHex](Bytes.md#tohex). #### Returns `string` #### Inherited from [`Bytes`](Bytes.md).[`represent`](Bytes.md#represent) *** ### toBase32() > **toBase32**(): `string` Defined in: [core-sdk/src/bytes/bytes.ts:138](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L138) Encodes as a padded base32 string. #### Returns `string` #### Inherited from [`Bytes`](Bytes.md).[`toBase32`](Bytes.md#tobase32) *** ### toBase64() > **toBase64**(): `string` Defined in: [core-sdk/src/bytes/bytes.ts:131](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L131) Encodes as a padded base64 string. #### Returns `string` #### Inherited from [`Bytes`](Bytes.md).[`toBase64`](Bytes.md#tobase64) *** ### toBigInt() > **toBigInt**(): `bigint` Defined in: [core-sdk/src/bytes/span.ts:24](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/span.ts#L24) Decodes the span as a bigint byte count. #### Returns `bigint` *** ### toHex() > **toHex**(): `string` Defined in: [core-sdk/src/bytes/bytes.ts:124](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L124) Encodes as a lowercase hex string, with no `0x` prefix. #### Returns `string` #### Inherited from [`Bytes`](Bytes.md).[`toHex`](Bytes.md#tohex) *** ### toJSON() > **toJSON**(): `string` Defined in: [core-sdk/src/bytes/bytes.ts:166](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L166) Serialized as its hex string by `JSON.stringify`. #### Returns `string` #### Inherited from [`Bytes`](Bytes.md).[`toJSON`](Bytes.md#tojson) *** ### toString() > **toString**(): `string` Defined in: [core-sdk/src/bytes/bytes.ts:145](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L145) Same as [toHex](Bytes.md#tohex). #### Returns `string` #### Inherited from [`Bytes`](Bytes.md).[`toString`](Bytes.md#tostring) *** ### toUint8Array() > **toUint8Array**(): `Uint8Array` Defined in: [core-sdk/src/bytes/bytes.ts:117](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L117) Returns a copy of the underlying bytes. #### Returns `Uint8Array` #### Inherited from [`Bytes`](Bytes.md).[`toUint8Array`](Bytes.md#touint8array) *** ### toUtf8() > **toUtf8**(): `string` Defined in: [core-sdk/src/bytes/bytes.ts:152](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L152) Decodes the bytes as UTF-8 text. #### Returns `string` #### Inherited from [`Bytes`](Bytes.md).[`toUtf8`](Bytes.md#toutf8) *** ### concat() > `static` **concat**(...`arrays`): `Uint8Array` Defined in: [core-sdk/src/bytes/bytes.ts:75](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L75) Concatenates any number of byte arrays (or Bytes instances) into one new array. #### Parameters ##### arrays ...(`Uint8Array`\<`ArrayBufferLike`\> \| [`Bytes`](Bytes.md))[] #### Returns `Uint8Array` #### Inherited from [`Bytes`](Bytes.md).[`concat`](Bytes.md#concat) *** ### fromBigInt() > `static` **fromBigInt**(`value`): `Span` Defined in: [core-sdk/src/bytes/span.ts:17](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/span.ts#L17) Encodes a bigint byte count as an 8-byte, little-endian Span. #### Parameters ##### value `bigint` #### Returns `Span` *** ### fromSlice() > `static` **fromSlice**(`bytes`, `start`): `Span` Defined in: [core-sdk/src/bytes/span.ts:31](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/span.ts#L31) Reads an 8-byte Span out of a larger buffer, starting at `start`. #### Parameters ##### bytes `Uint8Array` ##### start `number` #### Returns `Span` #### Overrides [`Bytes`](Bytes.md).[`fromSlice`](Bytes.md#fromslice) *** ### fromUtf8() > `static` **fromUtf8**(`utf8`): [`Bytes`](Bytes.md) Defined in: [core-sdk/src/bytes/bytes.ts:92](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L92) Wraps the UTF-8 encoding of a string. #### Parameters ##### utf8 `string` #### Returns [`Bytes`](Bytes.md) #### Inherited from [`Bytes`](Bytes.md).[`fromUtf8`](Bytes.md#fromutf8) *** ### keccak256() > `static` **keccak256**(`bytes`): [`Bytes`](Bytes.md) Defined in: [core-sdk/src/bytes/bytes.ts:68](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L68) Hashes `bytes` with keccak256 and wraps the 32-byte digest. #### Parameters ##### bytes `string` | `ArrayBuffer` | `Uint8Array`\<`ArrayBufferLike`\> | [`Bytes`](Bytes.md) #### Returns [`Bytes`](Bytes.md) #### Inherited from [`Bytes`](Bytes.md).[`keccak256`](Bytes.md#keccak256) --- ## Class: Stake Defined in: [bee-js/src/modules/stake.ts:16](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/modules/stake.ts#L16) Staking operations. Accessed as `bee.stake`. ## Constructors ### Constructor > **new Stake**(`context`): `Stake` Defined in: [bee-js/src/modules/stake.ts:17](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/modules/stake.ts#L17) #### Parameters ##### context `BeeContext` #### Returns `Stake` ## Methods ### deposit() > **deposit**(`amount`, `options?`, `requestOptions?`): `Promise`\<[`TransactionId`](../classes/TransactionId.md)\> Defined in: [bee-js/src/modules/stake.ts:55](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/modules/stake.ts#L55) Stakes the given amount of BZZ. Must be at least [getMinimumDeposit](#getminimumdeposit), otherwise Bee rejects it with 400. Be aware that staked BZZ tokens can **not** be withdrawn. #### Parameters ##### amount Amount of BZZ tokens to be staked. If not providing a `BZZ` instance, the amount is denoted in PLUR. `string` | `bigint` | [`NumberString`](../type-aliases/NumberString.md) | [`BZZ`](../classes/BZZ.md) ##### options? [`TransactionOptions`](../interfaces/TransactionOptions.md) ##### requestOptions? [`BeeRequestOptions`](../type-aliases/BeeRequestOptions.md) Options for making requests, such as timeouts, custom HTTP agents, headers, etc. #### Returns `Promise`\<[`TransactionId`](../classes/TransactionId.md)\> *** ### get() > **get**(`requestOptions?`): `Promise`\<[`BZZ`](../classes/BZZ.md)\> Defined in: [bee-js/src/modules/stake.ts:24](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/modules/stake.ts#L24) Gets the amount of staked BZZ. #### Parameters ##### requestOptions? [`BeeRequestOptions`](../type-aliases/BeeRequestOptions.md) Options for making requests, such as timeouts, custom HTTP agents, headers, etc. #### Returns `Promise`\<[`BZZ`](../classes/BZZ.md)\> *** ### getMinimumDeposit() > **getMinimumDeposit**(`requestOptions?`): `Promise`\<[`BZZ`](../classes/BZZ.md) \| `null`\> Defined in: [bee-js/src/modules/stake.ts:31](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/modules/stake.ts#L31) Gets the minimum next deposit, or `null` when Bee cannot determine it (e.g. the price oracle is unavailable). #### Parameters ##### requestOptions? [`BeeRequestOptions`](../type-aliases/BeeRequestOptions.md) #### Returns `Promise`\<[`BZZ`](../classes/BZZ.md) \| `null`\> *** ### getRedistributionState() > **getRedistributionState**(`requestOptions?`): `Promise`\<[`RedistributionState`](../interfaces/RedistributionState.md)\> Defined in: [bee-js/src/modules/stake.ts:95](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/modules/stake.ts#L95) Gets current status of node in redistribution game. #### Parameters ##### requestOptions? [`BeeRequestOptions`](../type-aliases/BeeRequestOptions.md) Options for making requests, such as timeouts, custom HTTP agents, headers, etc. #### Returns `Promise`\<[`RedistributionState`](../interfaces/RedistributionState.md)\> *** ### getWithdrawable() > **getWithdrawable**(`requestOptions?`): `Promise`\<[`BZZ`](../classes/BZZ.md)\> Defined in: [bee-js/src/modules/stake.ts:42](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/modules/stake.ts#L42) Gets the amount of withdrawable staked BZZ. #### Parameters ##### requestOptions? [`BeeRequestOptions`](../type-aliases/BeeRequestOptions.md) Options for making requests, such as timeouts, custom HTTP agents, headers, etc. #### Returns `Promise`\<[`BZZ`](../classes/BZZ.md)\> *** ### migrate() > **migrate**(`requestOptions?`): `Promise`\<[`TransactionId`](../classes/TransactionId.md)\> Defined in: [bee-js/src/modules/stake.ts:86](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/modules/stake.ts#L86) Withdraws all staked BZZ to the node wallet. **Only available when the staking contract is paused and is in the process of being migrated to a new contract!** #### Parameters ##### requestOptions? [`BeeRequestOptions`](../type-aliases/BeeRequestOptions.md) Options for making requests, such as timeouts, custom HTTP agents, headers, etc. #### Returns `Promise`\<[`TransactionId`](../classes/TransactionId.md)\> *** ### setRedistributionEnabled() > **setRedistributionEnabled**(`enabled`, `requestOptions?`): `Promise`\<`boolean`\> Defined in: [bee-js/src/modules/stake.ts:100](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/modules/stake.ts#L100) Enables or disables participation in new redistribution rounds; resets to enabled when the node restarts. #### Parameters ##### enabled `boolean` ##### requestOptions? [`BeeRequestOptions`](../type-aliases/BeeRequestOptions.md) #### Returns `Promise`\<`boolean`\> *** ### withdrawSurplus() > **withdrawSurplus**(`requestOptions?`): `Promise`\<[`TransactionId`](../classes/TransactionId.md)\> Defined in: [bee-js/src/modules/stake.ts:75](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/modules/stake.ts#L75) Withdraws all surplus staked BZZ to the node wallet. #### Parameters ##### requestOptions? [`BeeRequestOptions`](../type-aliases/BeeRequestOptions.md) Options for making requests, such as timeouts, custom HTTP agents, headers, etc. #### Returns `Promise`\<[`TransactionId`](../classes/TransactionId.md)\> --- ## Class: Stamp Defined in: [bee-js/src/modules/stamp.ts:29](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/modules/stamp.ts#L29) Low-level postage batch (stamp) operations. Accessed as `bee.stamp`. For the ergonomic wrapper see `bee.storage`. ## Constructors ### Constructor > **new Stamp**(`context`): `Stamp` Defined in: [bee-js/src/modules/stamp.ts:30](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/modules/stamp.ts#L30) #### Parameters ##### context `BeeContext` #### Returns `Stamp` ## Methods ### calculateTopUpForBZZ() > **calculateTopUpForBZZ**(`depth`, `bzz`, `requestOptions?`): `Promise`\<\{ `amount`: `bigint`; `duration`: [`Duration`](../classes/Duration.md); \}\> Defined in: [bee-js/src/modules/stamp.ts:108](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/modules/stamp.ts#L108) Calculates the `amount` and expected duration extension for topping up a postage batch with a given BZZ value. #### Parameters ##### depth `number` Depth of the postage batch to top up. ##### bzz [`BZZ`](../classes/BZZ.md) The amount of BZZ to spend on the top-up. ##### requestOptions? [`BeeRequestOptions`](../type-aliases/BeeRequestOptions.md) Options for making requests, such as timeouts, custom HTTP agents, headers, etc. #### Returns `Promise`\<\{ `amount`: `bigint`; `duration`: [`Duration`](../classes/Duration.md); \}\> *** ### create() > **create**(`amount`, `depth`, `options?`, `requestOptions?`): `Promise`\<[`BatchId`](../classes/BatchId.md)\> Defined in: [bee-js/src/modules/stamp.ts:42](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/modules/stamp.ts#L42) Creates a new postage batch, spending BZZ tokens from the node wallet. Use `bee.storage.buy` for a more convenient way to create a postage batch. #### Parameters ##### amount TTL parameter - 1 day at the minimum of 24,000 storage price requires an amount of 414,720,000. `string` | `bigint` | [`NumberString`](../type-aliases/NumberString.md) ##### depth `number` Capacity parameter - 17..255. ##### options? [`PostageBatchOptions`](../interfaces/PostageBatchOptions.md) Options for creation of postage batch ##### requestOptions? [`BeeRequestOptions`](../type-aliases/BeeRequestOptions.md) Options for making requests, such as timeouts, custom HTTP agents, headers, etc. #### Returns `Promise`\<[`BatchId`](../classes/BatchId.md)\> *** ### dilute() > **dilute**(`postageBatchId`, `depth`, `requestOptions?`): `Promise`\<[`BatchId`](../classes/BatchId.md)\> Defined in: [bee-js/src/modules/stamp.ts:146](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/modules/stamp.ts#L146) Dilutes a postage batch to extend its capacity by increasing its depth. #### Parameters ##### postageBatchId Batch ID `string` | `Uint8Array`\<`ArrayBufferLike`\> | [`BatchId`](../classes/BatchId.md) ##### depth `number` New depth for the batch ##### requestOptions? [`BeeRequestOptions`](../type-aliases/BeeRequestOptions.md) Options for making requests, such as timeouts, custom HTTP agents, headers, etc. #### Returns `Promise`\<[`BatchId`](../classes/BatchId.md)\> *** ### get() > **get**(`postageBatchId`, `requestOptions?`, `encryption?`, `erasureCodeLevel?`): `Promise`\<[`PostageBatch`](../interfaces/PostageBatch.md)\> Defined in: [bee-js/src/modules/stamp.ts:165](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/modules/stamp.ts#L165) Returns details for a specific postage batch. #### Parameters ##### postageBatchId Batch ID `string` | `Uint8Array`\<`ArrayBufferLike`\> | [`BatchId`](../classes/BatchId.md) ##### requestOptions? [`BeeRequestOptions`](../type-aliases/BeeRequestOptions.md) Options for making requests, such as timeouts, custom HTTP agents, headers, etc. ##### encryption? `boolean` Assume that uploads with this postage batch are encrypted, which skews the capacity. ##### erasureCodeLevel? [`RedundancyLevel`](../enumerations/RedundancyLevel.md) Assume that uploads with this postage batch are erasure coded, which skews the capacity. #### Returns `Promise`\<[`PostageBatch`](../interfaces/PostageBatch.md)\> *** ### getAll() > **getAll**(`requestOptions?`): `Promise`\<[`PostageBatch`](../interfaces/PostageBatch.md)[]\> Defined in: [bee-js/src/modules/stamp.ts:216](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/modules/stamp.ts#L216) Returns all postage batches that belong to the node. #### Parameters ##### requestOptions? [`BeeRequestOptions`](../type-aliases/BeeRequestOptions.md) Options for making requests, such as timeouts, custom HTTP agents, headers, etc. #### Returns `Promise`\<[`PostageBatch`](../interfaces/PostageBatch.md)[]\> *** ### getAllGlobal() > **getAllGlobal**(`requestOptions?`): `Promise`\<[`GlobalPostageBatch`](../interfaces/GlobalPostageBatch.md)[]\> Defined in: [bee-js/src/modules/stamp.ts:225](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/modules/stamp.ts#L225) Returns all globally available postage batches. #### Parameters ##### requestOptions? [`BeeRequestOptions`](../type-aliases/BeeRequestOptions.md) Options for making requests, such as timeouts, custom HTTP agents, headers, etc. #### Returns `Promise`\<[`GlobalPostageBatch`](../interfaces/GlobalPostageBatch.md)[]\> *** ### getBuckets() > **getBuckets**(`postageBatchId`, `requestOptions?`): `Promise`\<[`PostageBatchBuckets`](../interfaces/PostageBatchBuckets.md)\> Defined in: [bee-js/src/modules/stamp.ts:202](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/modules/stamp.ts#L202) Returns detailed information related to buckets for a specific postage batch. #### Parameters ##### postageBatchId Batch ID `string` | `Uint8Array`\<`ArrayBufferLike`\> | [`BatchId`](../classes/BatchId.md) ##### requestOptions? [`BeeRequestOptions`](../type-aliases/BeeRequestOptions.md) Options for making requests, such as timeouts, custom HTTP agents, headers, etc. #### Returns `Promise`\<[`PostageBatchBuckets`](../interfaces/PostageBatchBuckets.md)\> *** ### getGlobal() > **getGlobal**(`postageBatchId`, `requestOptions?`): `Promise`\<[`GlobalPostageBatch`](../interfaces/GlobalPostageBatch.md)\> Defined in: [bee-js/src/modules/stamp.ts:187](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/modules/stamp.ts#L187) Returns details for a specific globally available postage batch. #### Parameters ##### postageBatchId Batch ID `string` | `Uint8Array`\<`ArrayBufferLike`\> | [`BatchId`](../classes/BatchId.md) ##### requestOptions? [`BeeRequestOptions`](../type-aliases/BeeRequestOptions.md) Options for making requests, such as timeouts, custom HTTP agents, headers, etc. #### Returns `Promise`\<[`GlobalPostageBatch`](../interfaces/GlobalPostageBatch.md)\> *** ### topUp() > **topUp**(`postageBatchId`, `amount`, `requestOptions?`): `Promise`\<[`BatchId`](../classes/BatchId.md)\> Defined in: [bee-js/src/modules/stamp.ts:128](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/modules/stamp.ts#L128) Increases the duration of a postage batch by increasing its amount. #### Parameters ##### postageBatchId Batch ID `string` | `Uint8Array`\<`ArrayBufferLike`\> | [`BatchId`](../classes/BatchId.md) ##### amount Amount to be added to the batch `string` | `bigint` | [`NumberString`](../type-aliases/NumberString.md) ##### requestOptions? [`BeeRequestOptions`](../type-aliases/BeeRequestOptions.md) Options for making requests, such as timeouts, custom HTTP agents, headers, etc. #### Returns `Promise`\<[`BatchId`](../classes/BatchId.md)\> *** ### updateLabel() > **updateLabel**(`postageBatchId`, `label`, `requestOptions?`): `Promise`\<`void`\> Defined in: [bee-js/src/modules/stamp.ts:91](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/modules/stamp.ts#L91) Updates the label of a certain postage batch. #### Parameters ##### postageBatchId Batch ID of the postage batch to update. `string` | `Uint8Array`\<`ArrayBufferLike`\> | [`BatchId`](../classes/BatchId.md) ##### label `string` New label for the postage batch. ##### requestOptions? [`BeeRequestOptions`](../type-aliases/BeeRequestOptions.md) Options for making requests, such as timeouts, custom HTTP agents, headers, etc. #### Returns `Promise`\<`void`\> --- ## Class: Stamper Defined in: [core-sdk/src/stamper/stamper.ts:45](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/stamper/stamper.ts#L45) Stateful postage stamp issuer: tracks how many chunks have been stamped into each of the batch's 65536 buckets, so each chunk gets a distinct, capacity-respecting index without the caller managing that bookkeeping. ## Properties ### batchId > **batchId**: [`BatchId`](BatchId.md) Defined in: [core-sdk/src/stamper/stamper.ts:47](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/stamper/stamper.ts#L47) *** ### buckets > **buckets**: `Uint32Array` Defined in: [core-sdk/src/stamper/stamper.ts:48](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/stamper/stamper.ts#L48) *** ### depth > **depth**: `number` Defined in: [core-sdk/src/stamper/stamper.ts:49](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/stamper/stamper.ts#L49) *** ### maxSlot > **maxSlot**: `number` Defined in: [core-sdk/src/stamper/stamper.ts:50](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/stamper/stamper.ts#L50) *** ### signer > **signer**: [`PrivateKey`](PrivateKey.md) Defined in: [core-sdk/src/stamper/stamper.ts:46](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/stamper/stamper.ts#L46) ## Methods ### getState() > **getState**(): `Uint32Array` Defined in: [core-sdk/src/stamper/stamper.ts:108](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/stamper/stamper.ts#L108) Returns the live bucket-height state, for persisting and later resuming via [fromState](#fromstate). #### Returns `Uint32Array` *** ### stamp() > **stamp**(`address`, `timestampMs?`): [`EnvelopeWithBatchId`](../interfaces/EnvelopeWithBatchId.md) Defined in: [core-sdk/src/stamper/stamper.ts:91](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/stamper/stamper.ts#L91) Stamps a chunk address, automatically picking and reserving the next free slot in its bucket. Throws once a bucket reaches its depth-derived capacity. #### Parameters ##### address `Uint8Array` ##### timestampMs? `number` #### Returns [`EnvelopeWithBatchId`](../interfaces/EnvelopeWithBatchId.md) *** ### fromBlank() > `static` **fromBlank**(`signer`, `batchId`, `depth`): `Stamper` Defined in: [core-sdk/src/stamper/stamper.ts:67](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/stamper/stamper.ts#L67) Creates a fresh Stamper for a batch with no chunks stamped yet. #### Parameters ##### signer `string` | `Uint8Array`\<`ArrayBufferLike`\> | [`PrivateKey`](PrivateKey.md) ##### batchId `string` | `Uint8Array`\<`ArrayBufferLike`\> | [`BatchId`](BatchId.md) ##### depth `number` #### Returns `Stamper` *** ### fromState() > `static` **fromState**(`signer`, `batchId`, `buckets`, `depth`): `Stamper` Defined in: [core-sdk/src/stamper/stamper.ts:78](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/stamper/stamper.ts#L78) Resumes a Stamper from a previously persisted bucket state (see [getState](#getstate)). #### Parameters ##### signer `string` | `Uint8Array`\<`ArrayBufferLike`\> | [`PrivateKey`](PrivateKey.md) ##### batchId `string` | `Uint8Array`\<`ArrayBufferLike`\> | [`BatchId`](BatchId.md) ##### buckets `Uint32Array` ##### depth `number` #### Returns `Stamper` --- ## Class: Status Defined in: [bee-js/src/modules/status.ts:13](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/modules/status.ts#L13) Node status, health, version and chain/reserve state operations. Accessed as `bee.status`. ## Constructors ### Constructor > **new Status**(`context`): `Status` Defined in: [bee-js/src/modules/status.ts:14](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/modules/status.ts#L14) #### Parameters ##### context `BeeContext` #### Returns `Status` ## Methods ### get() > **get**(`requestOptions?`): `Promise`\<[`DebugStatus`](../interfaces/DebugStatus.md)\> Defined in: [bee-js/src/modules/status.ts:21](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/modules/status.ts#L21) Gets the general status of the node. #### Parameters ##### requestOptions? [`BeeRequestOptions`](../type-aliases/BeeRequestOptions.md) Options for making requests, such as timeouts, custom HTTP agents, headers, etc. #### Returns `Promise`\<[`DebugStatus`](../interfaces/DebugStatus.md)\> *** ### getChainState() > **getChainState**(`requestOptions?`): `Promise`\<[`ChainState`](../interfaces/ChainState.md)\> Defined in: [bee-js/src/modules/status.ts:107](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/modules/status.ts#L107) Gets chain state. #### Parameters ##### requestOptions? [`BeeRequestOptions`](../type-aliases/BeeRequestOptions.md) Options for making requests, such as timeouts, custom HTTP agents, headers, etc. #### Returns `Promise`\<[`ChainState`](../interfaces/ChainState.md)\> *** ### getHealth() > **getHealth**(`requestOptions?`): `Promise`\<[`Health`](../interfaces/Health.md)\> Defined in: [bee-js/src/modules/status.ts:30](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/modules/status.ts#L30) Gets the health of the node. #### Parameters ##### requestOptions? [`BeeRequestOptions`](../type-aliases/BeeRequestOptions.md) Options for making requests, such as timeouts, custom HTTP agents, headers, etc. #### Returns `Promise`\<[`Health`](../interfaces/Health.md)\> *** ### getNodeInfo() > **getNodeInfo**(`requestOptions?`): `Promise`\<[`NodeInfo`](../interfaces/NodeInfo.md)\> Defined in: [bee-js/src/modules/status.ts:48](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/modules/status.ts#L48) Gets mode information of the node. #### Parameters ##### requestOptions? [`BeeRequestOptions`](../type-aliases/BeeRequestOptions.md) Options for making requests, such as timeouts, custom HTTP agents, headers, etc. #### Returns `Promise`\<[`NodeInfo`](../interfaces/NodeInfo.md)\> *** ### getReadiness() > **getReadiness**(`requestOptions?`): `Promise`\<[`Readiness`](../interfaces/Readiness.md)\> Defined in: [bee-js/src/modules/status.ts:39](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/modules/status.ts#L39) Gets the readiness status of the node. #### Parameters ##### requestOptions? [`BeeRequestOptions`](../type-aliases/BeeRequestOptions.md) Options for making requests, such as timeouts, custom HTTP agents, headers, etc. #### Returns `Promise`\<[`Readiness`](../interfaces/Readiness.md)\> *** ### getReserveState() > **getReserveState**(`requestOptions?`): `Promise`\<[`ReserveState`](../interfaces/ReserveState.md)\> Defined in: [bee-js/src/modules/status.ts:98](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/modules/status.ts#L98) Gets reserve state. #### Parameters ##### requestOptions? [`BeeRequestOptions`](../type-aliases/BeeRequestOptions.md) Options for making requests, such as timeouts, custom HTTP agents, headers, etc. #### Returns `Promise`\<[`ReserveState`](../interfaces/ReserveState.md)\> *** ### getVersions() > **getVersions**(`requestOptions?`): `Promise`\<[`BeeVersions`](../interfaces/BeeVersions.md)\> Defined in: [bee-js/src/modules/status.ts:82](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/modules/status.ts#L82) Returns object with all versions specified by the connected Bee node (properties prefixed with `bee*`) and versions that bee-js supports (properties prefixed with `supported*`). #### Parameters ##### requestOptions? [`BeeRequestOptions`](../type-aliases/BeeRequestOptions.md) Options for making requests, such as timeouts, custom HTTP agents, headers, etc. #### Returns `Promise`\<[`BeeVersions`](../interfaces/BeeVersions.md)\> *** ### isSupportedApiVersion() > **isSupportedApiVersion**(`requestOptions?`): `Promise`\<`boolean`\> Defined in: [bee-js/src/modules/status.ts:70](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/modules/status.ts#L70) Connects to a node and checks if its Main API version matches with the one that bee-js supports. This should be the main way how to check compatibility for your app and Bee node. #### Parameters ##### requestOptions? [`BeeRequestOptions`](../type-aliases/BeeRequestOptions.md) Options for making requests, such as timeouts, custom HTTP agents, headers, etc. #### Returns `Promise`\<`boolean`\> *** ### isSupportedExactVersion() > **isSupportedExactVersion**(`requestOptions?`): `Promise`\<`boolean`\> Defined in: [bee-js/src/modules/status.ts:57](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/modules/status.ts#L57) Connects to a node and checks if its version matches with the one that bee-js supports. #### Parameters ##### requestOptions? [`BeeRequestOptions`](../type-aliases/BeeRequestOptions.md) Options for making requests, such as timeouts, custom HTTP agents, headers, etc. #### Returns `Promise`\<`boolean`\> --- ## Class: Storage Defined in: [bee-js/src/modules/storage.ts:16](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/modules/storage.ts#L16) Ergonomic storage operations expressed in terms of size and duration. Accessed as `bee.storage`. Wraps the low-level `bee.stamp` operations. ## Constructors ### Constructor > **new Storage**(`context`): `Storage` Defined in: [bee-js/src/modules/storage.ts:17](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/modules/storage.ts#L17) #### Parameters ##### context `BeeContext` #### Returns `Storage` ## Methods ### buy() > **buy**(`size`, `duration`, `options?`, `requestOptions?`, `encryption?`, `erasureCodeLevel?`): `Promise`\<[`BatchId`](../classes/BatchId.md)\> Defined in: [bee-js/src/modules/storage.ts:35](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/modules/storage.ts#L35) Creates a postage batch sized for a certain size and duration on the Swarm network. Use [getCost](#getcost) to calculate the cost beforehand. #### Parameters ##### size [`Size`](../classes/Size.md) ##### duration [`Duration`](../classes/Duration.md) ##### options? [`PostageBatchOptions`](../interfaces/PostageBatchOptions.md) ##### requestOptions? [`BeeRequestOptions`](../type-aliases/BeeRequestOptions.md) Options for making requests, such as timeouts, custom HTTP agents, headers, etc. ##### encryption? `boolean` ##### erasureCodeLevel? [`RedundancyLevel`](../enumerations/RedundancyLevel.md) #### Returns `Promise`\<[`BatchId`](../classes/BatchId.md)\> *** ### extend() > **extend**(`postageBatchId`, `size`, `duration`, `requestOptions?`, `encryption?`, `erasureCodeLevel?`): `Promise`\<[`BatchId`](../classes/BatchId.md) \| [`TransactionId`](../classes/TransactionId.md)\> Defined in: [bee-js/src/modules/storage.ts:89](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/modules/storage.ts#L89) Extends the storage of a postage batch by either increasing its size, duration or both. The size is ABSOLUTE, while the duration is RELATIVE to the current duration of the postage batch. #### Parameters ##### postageBatchId Batch ID of the postage batch to extend. `string` | `Uint8Array`\<`ArrayBufferLike`\> | [`BatchId`](../classes/BatchId.md) ##### size [`Size`](../classes/Size.md) Absolute size to extend the postage batch to. ##### duration [`Duration`](../classes/Duration.md) Relative duration to extend the postage batch by. ##### requestOptions? [`BeeRequestOptions`](../type-aliases/BeeRequestOptions.md) Options for making requests, such as timeouts, custom HTTP agents, headers, etc. ##### encryption? `boolean` Assume the future uploaded data is encrypted, which skews the capacity of the postage batch. ##### erasureCodeLevel? [`RedundancyLevel`](../enumerations/RedundancyLevel.md) Assume the future uploaded data is erasure coded, which skews the capacity of the postage batch. #### Returns `Promise`\<[`BatchId`](../classes/BatchId.md) \| [`TransactionId`](../classes/TransactionId.md)\> *** ### extendDuration() > **extendDuration**(`postageBatchId`, `duration`, `requestOptions?`): `Promise`\<[`BatchId`](../classes/BatchId.md)\> Defined in: [bee-js/src/modules/storage.ts:165](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/modules/storage.ts#L165) Extends the duration of a postage batch. #### Parameters ##### postageBatchId `string` | `Uint8Array`\<`ArrayBufferLike`\> | [`BatchId`](../classes/BatchId.md) ##### duration [`Duration`](../classes/Duration.md) Relative duration to extend the postage batch by. ##### requestOptions? [`BeeRequestOptions`](../type-aliases/BeeRequestOptions.md) Options for making requests, such as timeouts, custom HTTP agents, headers, etc. #### Returns `Promise`\<[`BatchId`](../classes/BatchId.md)\> *** ### extendSize() > **extendSize**(`postageBatchId`, `size`, `requestOptions?`, `encryption?`, `erasureCodeLevel?`): `Promise`\<[`BatchId`](../classes/BatchId.md)\> Defined in: [bee-js/src/modules/storage.ts:136](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/modules/storage.ts#L136) Extends the storage size of a postage batch by increasing its depth. #### Parameters ##### postageBatchId `string` | `Uint8Array`\<`ArrayBufferLike`\> | [`BatchId`](../classes/BatchId.md) ##### size [`Size`](../classes/Size.md) Absolute size to extend the postage batch to. ##### requestOptions? [`BeeRequestOptions`](../type-aliases/BeeRequestOptions.md) Options for making requests, such as timeouts, custom HTTP agents, headers, etc. ##### encryption? `boolean` Assume the future uploaded data is encrypted, which skews the capacity of the postage batch. ##### erasureCodeLevel? [`RedundancyLevel`](../enumerations/RedundancyLevel.md) Assume the future uploaded data is erasure coded, which skews the capacity of the postage batch. #### Returns `Promise`\<[`BatchId`](../classes/BatchId.md)\> *** ### getCost() > **getCost**(`size`, `duration`, `requestOptions?`, `encryption?`, `erasureCodeLevel?`): `Promise`\<[`BZZ`](../classes/BZZ.md)\> Defined in: [bee-js/src/modules/storage.ts:63](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/modules/storage.ts#L63) Calculates the estimated BZZ cost for creating a postage batch for the given size and duration. #### Parameters ##### size [`Size`](../classes/Size.md) Size of the data to be stored. ##### duration [`Duration`](../classes/Duration.md) Duration for which the data should be stored. ##### requestOptions? [`BeeRequestOptions`](../type-aliases/BeeRequestOptions.md) Options for making requests, such as timeouts, custom HTTP agents, headers, etc. ##### encryption? `boolean` Assume the future uploaded data is encrypted, which skews the capacity of the postage batch. ##### erasureCodeLevel? [`RedundancyLevel`](../enumerations/RedundancyLevel.md) Assume the future uploaded data is erasure coded, which skews the capacity of the postage batch. #### Returns `Promise`\<[`BZZ`](../classes/BZZ.md)\> *** ### getDurationExtensionCost() > **getDurationExtensionCost**(`postageBatchId`, `duration`, `requestOptions?`): `Promise`\<[`BZZ`](../classes/BZZ.md)\> Defined in: [bee-js/src/modules/storage.ts:246](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/modules/storage.ts#L246) Calculates the cost of extending the duration of a postage batch. #### Parameters ##### postageBatchId `string` | `Uint8Array`\<`ArrayBufferLike`\> | [`BatchId`](../classes/BatchId.md) ##### duration [`Duration`](../classes/Duration.md) ##### requestOptions? [`BeeRequestOptions`](../type-aliases/BeeRequestOptions.md) Options for making requests, such as timeouts, custom HTTP agents, headers, etc. #### Returns `Promise`\<[`BZZ`](../classes/BZZ.md)\> *** ### getExtensionCost() > **getExtensionCost**(`postageBatchId`, `size`, `duration`, `requestOptions?`, `encryption?`, `erasureCodeLevel?`): `Promise`\<[`BZZ`](../classes/BZZ.md)\> Defined in: [bee-js/src/modules/storage.ts:187](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/modules/storage.ts#L187) Calculates the cost of extending both the duration and the capacity of a postage batch. #### Parameters ##### postageBatchId `string` | `Uint8Array`\<`ArrayBufferLike`\> | [`BatchId`](../classes/BatchId.md) ##### size [`Size`](../classes/Size.md) Absolute size to extend the postage batch to. ##### duration [`Duration`](../classes/Duration.md) Relative duration to extend the postage batch by. ##### requestOptions? [`BeeRequestOptions`](../type-aliases/BeeRequestOptions.md) Options for making requests, such as timeouts, custom HTTP agents, headers, etc. ##### encryption? `boolean` Assume the future uploaded data is encrypted, which skews the capacity of the postage batch. ##### erasureCodeLevel? [`RedundancyLevel`](../enumerations/RedundancyLevel.md) Assume the future uploaded data is erasure coded, which skews the capacity of the postage batch. #### Returns `Promise`\<[`BZZ`](../classes/BZZ.md)\> *** ### getSizeExtensionCost() > **getSizeExtensionCost**(`postageBatchId`, `size`, `requestOptions?`, `encryption?`, `erasureCodeLevel?`): `Promise`\<[`BZZ`](../classes/BZZ.md)\> Defined in: [bee-js/src/modules/storage.ts:216](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/modules/storage.ts#L216) Calculates the cost of extending the size of a postage batch. #### Parameters ##### postageBatchId `string` | `Uint8Array`\<`ArrayBufferLike`\> | [`BatchId`](../classes/BatchId.md) ##### size [`Size`](../classes/Size.md) ##### requestOptions? [`BeeRequestOptions`](../type-aliases/BeeRequestOptions.md) Options for making requests, such as timeouts, custom HTTP agents, headers, etc. ##### encryption? `boolean` Assume the future uploaded data is encrypted, which skews the capacity of the postage batch. ##### erasureCodeLevel? [`RedundancyLevel`](../enumerations/RedundancyLevel.md) Assume the future uploaded data is erasure coded, which skews the capacity of the postage batch. #### Returns `Promise`\<[`BZZ`](../classes/BZZ.md)\> *** ### rename() > **rename**(`postageBatchId`, `newLabel`, `requestOptions?`): `Promise`\<`void`\> Defined in: [bee-js/src/modules/storage.ts:265](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/modules/storage.ts#L265) Renames a storage. Convenience wrapper over `bee.stamp.updateLabel`. #### Parameters ##### postageBatchId Batch ID of the postage batch to update. `string` | `Uint8Array`\<`ArrayBufferLike`\> | [`BatchId`](../classes/BatchId.md) ##### newLabel `string` New name for the storage. ##### requestOptions? [`BeeRequestOptions`](../type-aliases/BeeRequestOptions.md) Options for making requests, such as timeouts, custom HTTP agents, headers, etc. #### Returns `Promise`\<`void`\> --- ## Class: Tag Defined in: [bee-js/src/modules/tag.ts:13](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/modules/tag.ts#L13) Tag operations for tracking upload and synchronization progress. Accessed as `bee.tag`. ## Constructors ### Constructor > **new Tag**(`context`): `Tag` Defined in: [bee-js/src/modules/tag.ts:14](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/modules/tag.ts#L14) #### Parameters ##### context `BeeContext` #### Returns `Tag` ## Methods ### create() > **create**(`requestOptions?`): `Promise`\<[`Tag`](../interfaces/Tag.md)\> Defined in: [bee-js/src/modules/tag.ts:21](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/modules/tag.ts#L21) Creates a new tag which is meant for tracking upload and synchronization progress. #### Parameters ##### requestOptions? [`BeeRequestOptions`](../type-aliases/BeeRequestOptions.md) Options for making requests, such as timeouts, custom HTTP agents, headers, etc. #### Returns `Promise`\<[`Tag`](../interfaces/Tag.md)\> *** ### delete() > **delete**(`tagUid`, `requestOptions?`): `Promise`\<`void`\> Defined in: [bee-js/src/modules/tag.ts:57](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/modules/tag.ts#L57) Deletes a tag. #### Parameters ##### tagUid UID or tag object to be deleted `number` | [`Tag`](../interfaces/Tag.md) ##### requestOptions? [`BeeRequestOptions`](../type-aliases/BeeRequestOptions.md) Options for making requests, such as timeouts, custom HTTP agents, headers, etc. #### Returns `Promise`\<`void`\> *** ### get() > **get**(`tagUid`, `requestOptions?`): `Promise`\<[`Tag`](../interfaces/Tag.md)\> Defined in: [bee-js/src/modules/tag.ts:45](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/modules/tag.ts#L45) Retrieves tag information from the Bee node. #### Parameters ##### tagUid UID or tag object to be retrieved `number` | [`Tag`](../interfaces/Tag.md) ##### requestOptions? [`BeeRequestOptions`](../type-aliases/BeeRequestOptions.md) Options for making requests, such as timeouts, custom HTTP agents, headers, etc. #### Returns `Promise`\<[`Tag`](../interfaces/Tag.md)\> *** ### getAll() > **getAll**(`options?`, `requestOptions?`): `Promise`\<[`Tag`](../interfaces/Tag.md)[]\> Defined in: [bee-js/src/modules/tag.ts:31](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/modules/tag.ts#L31) Fetches all tags in a paginated manner. #### Parameters ##### options? [`AllTagsOptions`](../interfaces/AllTagsOptions.md) Specify `limit` and `offset` to paginate through the tags. ##### requestOptions? [`BeeRequestOptions`](../type-aliases/BeeRequestOptions.md) Options for making requests, such as timeouts, custom HTTP agents, headers, etc. #### Returns `Promise`\<[`Tag`](../interfaces/Tag.md)[]\> *** ### update() > **update**(`tagUid`, `reference`, `requestOptions?`): `Promise`\<`void`\> Defined in: [bee-js/src/modules/tag.ts:70](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/modules/tag.ts#L70) Updates a tag's total chunks count. #### Parameters ##### tagUid UID or tag object to be updated `number` | [`Tag`](../interfaces/Tag.md) ##### reference The root reference that contains all the chunks to be counted `string` | [`Reference`](../classes/Reference.md) ##### requestOptions? [`BeeRequestOptions`](../type-aliases/BeeRequestOptions.md) Options for making requests, such as timeouts, custom HTTP agents, headers, etc. #### Returns `Promise`\<`void`\> --- ## Class: Topic Defined in: [core-sdk/src/bytes/topic.ts:9](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/topic.ts#L9) A 32-byte feed topic - identifies a feed stream, independent of its owner. ## Extends - [`Bytes`](Bytes.md) ## Constructors ### Constructor > **new Topic**(`bytes`): `Topic` Defined in: [core-sdk/src/bytes/topic.ts:12](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/topic.ts#L12) #### Parameters ##### bytes `string` | `Uint8Array`\<`ArrayBufferLike`\> | [`Bytes`](Bytes.md) #### Returns `Topic` #### Overrides [`Bytes`](Bytes.md).[`constructor`](Bytes.md#constructor) ## Properties ### length > `readonly` **length**: `number` Defined in: [core-sdk/src/bytes/bytes.ts:19](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L19) #### Inherited from [`Bytes`](Bytes.md).[`length`](Bytes.md#length) *** ### LENGTH > `readonly` `static` **LENGTH**: `32` = `32` Defined in: [core-sdk/src/bytes/topic.ts:10](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/topic.ts#L10) ## Methods ### equals() > **equals**(`other`): `boolean` Defined in: [core-sdk/src/bytes/bytes.ts:173](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L173) Byte-wise equality against another Bytes instance, raw bytes, or hex string. #### Parameters ##### other `string` | `Uint8Array`\<`ArrayBufferLike`\> | [`Bytes`](Bytes.md) #### Returns `boolean` #### Inherited from [`Bytes`](Bytes.md).[`equals`](Bytes.md#equals) *** ### offset() > **offset**(`index`): `Uint8Array` Defined in: [core-sdk/src/bytes/bytes.ts:110](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L110) Returns a copy of the bytes from `index` to the end. #### Parameters ##### index `number` #### Returns `Uint8Array` #### Inherited from [`Bytes`](Bytes.md).[`offset`](Bytes.md#offset) *** ### parsePayloadAsJson() > **parsePayloadAsJson**(): `unknown` Defined in: [core-sdk/src/bytes/bytes.ts:159](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L159) Parses the bytes as UTF-8 JSON. #### Returns `unknown` #### Inherited from [`Bytes`](Bytes.md).[`parsePayloadAsJson`](Bytes.md#parsepayloadasjson) *** ### represent() > **represent**(): `string` Defined in: [core-sdk/src/bytes/bytes.ts:180](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L180) Human-readable representation, used by debuggers/loggers. Same as [toHex](Bytes.md#tohex). #### Returns `string` #### Inherited from [`Bytes`](Bytes.md).[`represent`](Bytes.md#represent) *** ### toBase32() > **toBase32**(): `string` Defined in: [core-sdk/src/bytes/bytes.ts:138](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L138) Encodes as a padded base32 string. #### Returns `string` #### Inherited from [`Bytes`](Bytes.md).[`toBase32`](Bytes.md#tobase32) *** ### toBase64() > **toBase64**(): `string` Defined in: [core-sdk/src/bytes/bytes.ts:131](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L131) Encodes as a padded base64 string. #### Returns `string` #### Inherited from [`Bytes`](Bytes.md).[`toBase64`](Bytes.md#tobase64) *** ### toHex() > **toHex**(): `string` Defined in: [core-sdk/src/bytes/bytes.ts:124](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L124) Encodes as a lowercase hex string, with no `0x` prefix. #### Returns `string` #### Inherited from [`Bytes`](Bytes.md).[`toHex`](Bytes.md#tohex) *** ### toJSON() > **toJSON**(): `string` Defined in: [core-sdk/src/bytes/bytes.ts:166](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L166) Serialized as its hex string by `JSON.stringify`. #### Returns `string` #### Inherited from [`Bytes`](Bytes.md).[`toJSON`](Bytes.md#tojson) *** ### toString() > **toString**(): `string` Defined in: [core-sdk/src/bytes/bytes.ts:145](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L145) Same as [toHex](Bytes.md#tohex). #### Returns `string` #### Inherited from [`Bytes`](Bytes.md).[`toString`](Bytes.md#tostring) *** ### toUint8Array() > **toUint8Array**(): `Uint8Array` Defined in: [core-sdk/src/bytes/bytes.ts:117](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L117) Returns a copy of the underlying bytes. #### Returns `Uint8Array` #### Inherited from [`Bytes`](Bytes.md).[`toUint8Array`](Bytes.md#touint8array) *** ### toUtf8() > **toUtf8**(): `string` Defined in: [core-sdk/src/bytes/bytes.ts:152](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L152) Decodes the bytes as UTF-8 text. #### Returns `string` #### Inherited from [`Bytes`](Bytes.md).[`toUtf8`](Bytes.md#toutf8) *** ### concat() > `static` **concat**(...`arrays`): `Uint8Array` Defined in: [core-sdk/src/bytes/bytes.ts:75](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L75) Concatenates any number of byte arrays (or Bytes instances) into one new array. #### Parameters ##### arrays ...(`Uint8Array`\<`ArrayBufferLike`\> \| [`Bytes`](Bytes.md))[] #### Returns `Uint8Array` #### Inherited from [`Bytes`](Bytes.md).[`concat`](Bytes.md#concat) *** ### fromSlice() > `static` **fromSlice**(`bytes`, `start`, `length?`): [`Bytes`](Bytes.md) Defined in: [core-sdk/src/bytes/bytes.ts:100](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L100) Wraps a slice of `bytes` starting at `start`, running to the end unless `length` is given. #### Parameters ##### bytes `Uint8Array` ##### start `number` ##### length? `number` #### Returns [`Bytes`](Bytes.md) #### Inherited from [`Bytes`](Bytes.md).[`fromSlice`](Bytes.md#fromslice) *** ### fromString() > `static` **fromString**(`value`): `Topic` Defined in: [core-sdk/src/bytes/topic.ts:19](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/topic.ts#L19) Derives a topic by hashing an arbitrary string with keccak256. #### Parameters ##### value `string` #### Returns `Topic` *** ### fromUtf8() > `static` **fromUtf8**(`utf8`): [`Bytes`](Bytes.md) Defined in: [core-sdk/src/bytes/bytes.ts:92](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L92) Wraps the UTF-8 encoding of a string. #### Parameters ##### utf8 `string` #### Returns [`Bytes`](Bytes.md) #### Inherited from [`Bytes`](Bytes.md).[`fromUtf8`](Bytes.md#fromutf8) *** ### keccak256() > `static` **keccak256**(`bytes`): [`Bytes`](Bytes.md) Defined in: [core-sdk/src/bytes/bytes.ts:68](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L68) Hashes `bytes` with keccak256 and wraps the 32-byte digest. #### Parameters ##### bytes `string` | `ArrayBuffer` | `Uint8Array`\<`ArrayBufferLike`\> | [`Bytes`](Bytes.md) #### Returns [`Bytes`](Bytes.md) #### Inherited from [`Bytes`](Bytes.md).[`keccak256`](Bytes.md#keccak256) --- ## Class: Transaction Defined in: [bee-js/src/modules/transaction.ts:12](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/modules/transaction.ts#L12) Pending transaction operations for the Bee node's `/transactions` queue. Accessed as `bee.transaction`. ## Constructors ### Constructor > **new Transaction**(`context`): `Transaction` Defined in: [bee-js/src/modules/transaction.ts:13](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/modules/transaction.ts#L13) #### Parameters ##### context `BeeContext` #### Returns `Transaction` ## Methods ### cancel() > **cancel**(`transactionHash`, `gasPrice?`, `requestOptions?`): `Promise`\<[`TransactionId`](../classes/TransactionId.md)\> Defined in: [bee-js/src/modules/transaction.ts:63](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/modules/transaction.ts#L63) Cancels a currently pending transaction. #### Parameters ##### transactionHash Hash of the transaction `string` | `Uint8Array`\<`ArrayBufferLike`\> | [`TransactionId`](../classes/TransactionId.md) ##### gasPrice? Optional gas price `string` | `bigint` | [`NumberString`](../type-aliases/NumberString.md) ##### requestOptions? [`BeeRequestOptions`](../type-aliases/BeeRequestOptions.md) Options for making requests, such as timeouts, custom HTTP agents, headers, etc. #### Returns `Promise`\<[`TransactionId`](../classes/TransactionId.md)\> *** ### get() > **get**(`transactionHash`, `requestOptions?`): `Promise`\<[`TransactionInfo`](../interfaces/TransactionInfo.md)\> Defined in: [bee-js/src/modules/transaction.ts:30](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/modules/transaction.ts#L30) Fetches the transaction information for a specific pending transaction. #### Parameters ##### transactionHash Hash of the transaction `string` | `Uint8Array`\<`ArrayBufferLike`\> | [`TransactionId`](../classes/TransactionId.md) ##### requestOptions? [`BeeRequestOptions`](../type-aliases/BeeRequestOptions.md) Options for making requests, such as timeouts, custom HTTP agents, headers, etc. #### Returns `Promise`\<[`TransactionInfo`](../interfaces/TransactionInfo.md)\> *** ### getAll() > **getAll**(`requestOptions?`): `Promise`\<[`TransactionInfo`](../interfaces/TransactionInfo.md)[]\> Defined in: [bee-js/src/modules/transaction.ts:20](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/modules/transaction.ts#L20) Fetches the list of all current pending transactions for the Bee node. #### Parameters ##### requestOptions? [`BeeRequestOptions`](../type-aliases/BeeRequestOptions.md) Options for making requests, such as timeouts, custom HTTP agents, headers, etc. #### Returns `Promise`\<[`TransactionInfo`](../interfaces/TransactionInfo.md)[]\> *** ### rebroadcast() > **rebroadcast**(`transactionHash`, `requestOptions?`): `Promise`\<[`TransactionId`](../classes/TransactionId.md)\> Defined in: [bee-js/src/modules/transaction.ts:47](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/modules/transaction.ts#L47) Rebroadcasts an already created pending transaction. Mainly needed when the transaction falls off the mempool or is not incorporated into any block. #### Parameters ##### transactionHash Hash of the transaction `string` | `Uint8Array`\<`ArrayBufferLike`\> | [`TransactionId`](../classes/TransactionId.md) ##### requestOptions? [`BeeRequestOptions`](../type-aliases/BeeRequestOptions.md) Options for making requests, such as timeouts, custom HTTP agents, headers, etc. #### Returns `Promise`\<[`TransactionId`](../classes/TransactionId.md)\> --- ## Class: TransactionId Defined in: [core-sdk/src/bytes/transaction-id.ts:6](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/transaction-id.ts#L6) A 32-byte blockchain transaction hash. ## Extends - [`Bytes`](Bytes.md) ## Constructors ### Constructor > **new TransactionId**(`bytes`): `TransactionId` Defined in: [core-sdk/src/bytes/transaction-id.ts:9](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/transaction-id.ts#L9) #### Parameters ##### bytes `string` | `Uint8Array`\<`ArrayBufferLike`\> | [`Bytes`](Bytes.md) #### Returns `TransactionId` #### Overrides [`Bytes`](Bytes.md).[`constructor`](Bytes.md#constructor) ## Properties ### length > `readonly` **length**: `number` Defined in: [core-sdk/src/bytes/bytes.ts:19](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L19) #### Inherited from [`Bytes`](Bytes.md).[`length`](Bytes.md#length) *** ### LENGTH > `readonly` `static` **LENGTH**: `32` = `32` Defined in: [core-sdk/src/bytes/transaction-id.ts:7](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/transaction-id.ts#L7) ## Methods ### equals() > **equals**(`other`): `boolean` Defined in: [core-sdk/src/bytes/bytes.ts:173](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L173) Byte-wise equality against another Bytes instance, raw bytes, or hex string. #### Parameters ##### other `string` | `Uint8Array`\<`ArrayBufferLike`\> | [`Bytes`](Bytes.md) #### Returns `boolean` #### Inherited from [`Bytes`](Bytes.md).[`equals`](Bytes.md#equals) *** ### offset() > **offset**(`index`): `Uint8Array` Defined in: [core-sdk/src/bytes/bytes.ts:110](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L110) Returns a copy of the bytes from `index` to the end. #### Parameters ##### index `number` #### Returns `Uint8Array` #### Inherited from [`Bytes`](Bytes.md).[`offset`](Bytes.md#offset) *** ### parsePayloadAsJson() > **parsePayloadAsJson**(): `unknown` Defined in: [core-sdk/src/bytes/bytes.ts:159](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L159) Parses the bytes as UTF-8 JSON. #### Returns `unknown` #### Inherited from [`Bytes`](Bytes.md).[`parsePayloadAsJson`](Bytes.md#parsepayloadasjson) *** ### represent() > **represent**(): `string` Defined in: [core-sdk/src/bytes/bytes.ts:180](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L180) Human-readable representation, used by debuggers/loggers. Same as [toHex](Bytes.md#tohex). #### Returns `string` #### Inherited from [`Bytes`](Bytes.md).[`represent`](Bytes.md#represent) *** ### toBase32() > **toBase32**(): `string` Defined in: [core-sdk/src/bytes/bytes.ts:138](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L138) Encodes as a padded base32 string. #### Returns `string` #### Inherited from [`Bytes`](Bytes.md).[`toBase32`](Bytes.md#tobase32) *** ### toBase64() > **toBase64**(): `string` Defined in: [core-sdk/src/bytes/bytes.ts:131](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L131) Encodes as a padded base64 string. #### Returns `string` #### Inherited from [`Bytes`](Bytes.md).[`toBase64`](Bytes.md#tobase64) *** ### toHex() > **toHex**(): `string` Defined in: [core-sdk/src/bytes/bytes.ts:124](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L124) Encodes as a lowercase hex string, with no `0x` prefix. #### Returns `string` #### Inherited from [`Bytes`](Bytes.md).[`toHex`](Bytes.md#tohex) *** ### toJSON() > **toJSON**(): `string` Defined in: [core-sdk/src/bytes/bytes.ts:166](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L166) Serialized as its hex string by `JSON.stringify`. #### Returns `string` #### Inherited from [`Bytes`](Bytes.md).[`toJSON`](Bytes.md#tojson) *** ### toString() > **toString**(): `string` Defined in: [core-sdk/src/bytes/bytes.ts:145](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L145) Same as [toHex](Bytes.md#tohex). #### Returns `string` #### Inherited from [`Bytes`](Bytes.md).[`toString`](Bytes.md#tostring) *** ### toUint8Array() > **toUint8Array**(): `Uint8Array` Defined in: [core-sdk/src/bytes/bytes.ts:117](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L117) Returns a copy of the underlying bytes. #### Returns `Uint8Array` #### Inherited from [`Bytes`](Bytes.md).[`toUint8Array`](Bytes.md#touint8array) *** ### toUtf8() > **toUtf8**(): `string` Defined in: [core-sdk/src/bytes/bytes.ts:152](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L152) Decodes the bytes as UTF-8 text. #### Returns `string` #### Inherited from [`Bytes`](Bytes.md).[`toUtf8`](Bytes.md#toutf8) *** ### concat() > `static` **concat**(...`arrays`): `Uint8Array` Defined in: [core-sdk/src/bytes/bytes.ts:75](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L75) Concatenates any number of byte arrays (or Bytes instances) into one new array. #### Parameters ##### arrays ...(`Uint8Array`\<`ArrayBufferLike`\> \| [`Bytes`](Bytes.md))[] #### Returns `Uint8Array` #### Inherited from [`Bytes`](Bytes.md).[`concat`](Bytes.md#concat) *** ### fromSlice() > `static` **fromSlice**(`bytes`, `start`, `length?`): [`Bytes`](Bytes.md) Defined in: [core-sdk/src/bytes/bytes.ts:100](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L100) Wraps a slice of `bytes` starting at `start`, running to the end unless `length` is given. #### Parameters ##### bytes `Uint8Array` ##### start `number` ##### length? `number` #### Returns [`Bytes`](Bytes.md) #### Inherited from [`Bytes`](Bytes.md).[`fromSlice`](Bytes.md#fromslice) *** ### fromUtf8() > `static` **fromUtf8**(`utf8`): [`Bytes`](Bytes.md) Defined in: [core-sdk/src/bytes/bytes.ts:92](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L92) Wraps the UTF-8 encoding of a string. #### Parameters ##### utf8 `string` #### Returns [`Bytes`](Bytes.md) #### Inherited from [`Bytes`](Bytes.md).[`fromUtf8`](Bytes.md#fromutf8) *** ### keccak256() > `static` **keccak256**(`bytes`): [`Bytes`](Bytes.md) Defined in: [core-sdk/src/bytes/bytes.ts:68](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/bytes/bytes.ts#L68) Hashes `bytes` with keccak256 and wraps the 32-byte digest. #### Parameters ##### bytes `string` | `ArrayBuffer` | `Uint8Array`\<`ArrayBufferLike`\> | [`Bytes`](Bytes.md) #### Returns [`Bytes`](Bytes.md) #### Inherited from [`Bytes`](Bytes.md).[`keccak256`](Bytes.md#keccak256) --- ## Class: Wallet Defined in: [bee-js/src/modules/wallet.ts:12](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/modules/wallet.ts#L12) Node wallet operations (balances and external withdrawals). Accessed as `bee.wallet`. ## Constructors ### Constructor > **new Wallet**(`context`): `Wallet` Defined in: [bee-js/src/modules/wallet.ts:13](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/modules/wallet.ts#L13) #### Parameters ##### context `BeeContext` #### Returns `Wallet` ## Methods ### getBalance() > **getBalance**(`requestOptions?`): `Promise`\<[`WalletBalance`](../interfaces/WalletBalance.md)\> Defined in: [bee-js/src/modules/wallet.ts:20](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/modules/wallet.ts#L20) Gets DAI and BZZ balances of the Bee node wallet. #### Parameters ##### requestOptions? [`BeeRequestOptions`](../type-aliases/BeeRequestOptions.md) Options for making requests, such as timeouts, custom HTTP agents, headers, etc. #### Returns `Promise`\<[`WalletBalance`](../interfaces/WalletBalance.md)\> *** ### withdrawBZZ() > **withdrawBZZ**(`amount`, `address`, `requestOptions?`): `Promise`\<[`TransactionId`](../classes/TransactionId.md)\> Defined in: [bee-js/src/modules/wallet.ts:31](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/modules/wallet.ts#L31) Withdraws BZZ from the node wallet (not chequebook) to a whitelisted external wallet address. #### Parameters ##### amount Amount of BZZ tokens to withdraw. If not providing a `BZZ` instance, the amount is denoted in PLUR. `string` | `bigint` | [`NumberString`](../type-aliases/NumberString.md) | [`BZZ`](../classes/BZZ.md) ##### address `string` | `Uint8Array`\<`ArrayBufferLike`\> | [`EthAddress`](../classes/EthAddress.md) ##### requestOptions? [`BeeRequestOptions`](../type-aliases/BeeRequestOptions.md) Options for making requests, such as timeouts, custom HTTP agents, headers, etc. #### Returns `Promise`\<[`TransactionId`](../classes/TransactionId.md)\> *** ### withdrawDAI() > **withdrawDAI**(`amount`, `address`, `requestOptions?`): `Promise`\<[`TransactionId`](../classes/TransactionId.md)\> Defined in: [bee-js/src/modules/wallet.ts:49](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/modules/wallet.ts#L49) Withdraws DAI from the node wallet (not chequebook) to a whitelisted external wallet address. #### Parameters ##### amount Amount of DAI tokens to withdraw. If not providing a `DAI` instance, the amount is denoted in wei. `string` | `bigint` | [`NumberString`](../type-aliases/NumberString.md) | [`DAI`](../classes/DAI.md) ##### address `string` | `Uint8Array`\<`ArrayBufferLike`\> | [`EthAddress`](../classes/EthAddress.md) ##### requestOptions? [`BeeRequestOptions`](../type-aliases/BeeRequestOptions.md) Options for making requests, such as timeouts, custom HTTP agents, headers, etc. #### Returns `Promise`\<[`TransactionId`](../classes/TransactionId.md)\> --- ## Enumeration: BeeModes Defined in: [bee-js/src/types/debug.ts:130](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/debug.ts#L130) ## Enumeration Members ### DEV > **DEV**: `"dev"` Defined in: [bee-js/src/types/debug.ts:134](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/debug.ts#L134) *** ### FULL > **FULL**: `"full"` Defined in: [bee-js/src/types/debug.ts:131](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/debug.ts#L131) *** ### LIGHT > **LIGHT**: `"light"` Defined in: [bee-js/src/types/debug.ts:132](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/debug.ts#L132) *** ### ULTRA\_LIGHT > **ULTRA\_LIGHT**: `"ultra-light"` Defined in: [bee-js/src/types/debug.ts:133](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/debug.ts#L133) --- ## Enumeration: RedundancyLevel Defined in: [bee-js/src/types/index.ts:184](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L184) Add redundancy to the data being uploaded so that downloaders can download it with better UX. 0 value is default and does not add any redundancy to the file. ## Enumeration Members ### INSANE > **INSANE**: `3` Defined in: [bee-js/src/types/index.ts:188](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L188) *** ### MEDIUM > **MEDIUM**: `1` Defined in: [bee-js/src/types/index.ts:186](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L186) *** ### OFF > **OFF**: `0` Defined in: [bee-js/src/types/index.ts:185](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L185) *** ### PARANOID > **PARANOID**: `4` Defined in: [bee-js/src/types/index.ts:189](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L189) *** ### STRONG > **STRONG**: `2` Defined in: [bee-js/src/types/index.ts:187](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L187) --- ## Enumeration: RedundancyStrategy Defined in: [bee-js/src/types/index.ts:206](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L206) Specify the retrieve strategy on redundant data. The possible values are NONE, DATA, PROX and RACE. Strategy NONE means no prefetching takes place. Strategy DATA means only data chunks are prefetched. Strategy PROX means only chunks that are close to the node are prefetched. Strategy RACE means all chunks are prefetched: n data chunks and k parity chunks. The first n chunks to arrive are used to reconstruct the file. Multiple strategies can be used in a fallback cascade if the swarm redundancy fallback mode is set to true. The default strategy is NONE, DATA, falling back to PROX, falling back to RACE ## Enumeration Members ### DATA > **DATA**: `1` Defined in: [bee-js/src/types/index.ts:208](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L208) *** ### NONE > **NONE**: `0` Defined in: [bee-js/src/types/index.ts:207](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L207) *** ### PROX > **PROX**: `2` Defined in: [bee-js/src/types/index.ts:209](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L209) *** ### RACE > **RACE**: `3` Defined in: [bee-js/src/types/index.ts:210](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L210) --- ## Function: toBeeMode() > **toBeeMode**(`value`): [`BeeModes`](../enumerations/BeeModes.md) Defined in: [bee-js/src/types/debug.ts:137](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/debug.ts#L137) ## Parameters ### value `string` ## Returns [`BeeModes`](../enumerations/BeeModes.md) --- ## Interface: AllSettlements Defined in: [bee-js/src/types/debug.ts:11](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/debug.ts#L11) ## Properties ### settlements > **settlements**: [`Settlements`](Settlements.md)[] Defined in: [bee-js/src/types/debug.ts:14](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/debug.ts#L14) *** ### totalReceived > **totalReceived**: [`BZZ`](../classes/BZZ.md) Defined in: [bee-js/src/types/debug.ts:12](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/debug.ts#L12) *** ### totalSent > **totalSent**: [`BZZ`](../classes/BZZ.md) Defined in: [bee-js/src/types/debug.ts:13](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/debug.ts#L13) --- ## Interface: AllTagsOptions Defined in: [bee-js/src/types/index.ts:308](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L308) ## Properties ### limit? > `optional` **limit**: `number` Defined in: [bee-js/src/types/index.ts:309](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L309) *** ### offset? > `optional` **offset**: `number` Defined in: [bee-js/src/types/index.ts:310](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L310) --- ## Interface: BalanceResponse Defined in: [bee-js/src/types/debug.ts:90](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/debug.ts#L90) ## Properties ### balances > **balances**: [`PeerBalance`](PeerBalance.md)[] Defined in: [bee-js/src/types/debug.ts:91](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/debug.ts#L91) --- ## Interface: BatchBucket Defined in: [bee-js/src/types/index.ts:579](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L579) ## Properties ### bucketID > **bucketID**: `number` Defined in: [bee-js/src/types/index.ts:580](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L580) *** ### collisions > **collisions**: `number` Defined in: [bee-js/src/types/index.ts:581](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L581) --- ## Interface: BeeOptions Defined in: [bee-js/src/types/index.ts:68](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L68) Options for the Bee client which affect all method calls *(unless overridden in the method call itself)*. Extends `BeeRequestOptions`, which allows configuring the HTTP client behavior, such as `timeout`, additional `headers`, custom `httpAgent`, etc. ## Extends - [`BeeRequestOptions`](../type-aliases/BeeRequestOptions.md) ## Properties ### baseURL? > `optional` **baseURL**: `string` Defined in: [bee-js/src/types/index.ts:52](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L52) #### Inherited from `BeeRequestOptions.baseURL` *** ### endlesslyRetry? > `optional` **endlesslyRetry**: `boolean` Defined in: [bee-js/src/types/index.ts:58](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L58) #### Inherited from `BeeRequestOptions.endlesslyRetry` *** ### headers? > `optional` **headers**: `Record`\<`string`, `string`\> Defined in: [bee-js/src/types/index.ts:54](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L54) #### Inherited from `BeeRequestOptions.headers` *** ### httpAgent? > `optional` **httpAgent**: `unknown` Defined in: [bee-js/src/types/index.ts:56](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L56) #### Inherited from `BeeRequestOptions.httpAgent` *** ### httpsAgent? > `optional` **httpsAgent**: `unknown` Defined in: [bee-js/src/types/index.ts:57](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L57) #### Inherited from `BeeRequestOptions.httpsAgent` *** ### network? > `optional` **network**: `"gnosis"` \| `"sepolia"` Defined in: [bee-js/src/types/index.ts:87](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L87) Network on which the Bee node is running. This is currently used to determine block time for postage batch time-to-live (TTL) calculations. The block time for `gnosis` is `5` seconds, and for `sepolia` it is `15` seconds. Default value is `gnosis`. *** ### onRequest()? > `optional` **onRequest**: (`request`) => `void` Defined in: [bee-js/src/types/index.ts:55](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L55) #### Parameters ##### request [`BeeRequest`](BeeRequest.md) #### Returns `void` #### Inherited from `BeeRequestOptions.onRequest` *** ### signal? > `optional` **signal**: `AbortSignal` Defined in: [bee-js/src/types/index.ts:59](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L59) #### Inherited from `BeeRequestOptions.signal` *** ### signer? > `optional` **signer**: `string` \| `Uint8Array`\<`ArrayBufferLike`\> \| [`PrivateKey`](../classes/PrivateKey.md) Defined in: [bee-js/src/types/index.ts:77](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L77) Default signer (a private key) used for signing. Mainly used in single-owner chunk (SOC) related operations, and consequently in feeds. If not provided, methods such as `makeFeedWriter` and `makeSOCWriter` must be provided with a private key in their respective function calls. *** ### timeout? > `optional` **timeout**: `number` Defined in: [bee-js/src/types/index.ts:53](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L53) #### Inherited from `BeeRequestOptions.timeout` --- ## Interface: BeeRequest Defined in: [bee-js/src/types/index.ts:411](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L411) ## Properties ### headers? > `optional` **headers**: `Record`\<`string`, `string`\> Defined in: [bee-js/src/types/index.ts:414](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L414) *** ### method > **method**: `string` Defined in: [bee-js/src/types/index.ts:413](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L413) *** ### params? > `optional` **params**: `Record`\<`string`, `unknown`\> Defined in: [bee-js/src/types/index.ts:415](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L415) *** ### url > **url**: `string` Defined in: [bee-js/src/types/index.ts:412](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L412) --- ## Interface: BeeResponse Defined in: [bee-js/src/types/index.ts:418](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L418) ## Properties ### headers > **headers**: `Record`\<`string`, `string`\> Defined in: [bee-js/src/types/index.ts:419](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L419) *** ### request > **request**: [`BeeRequest`](BeeRequest.md) Defined in: [bee-js/src/types/index.ts:422](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L422) *** ### status > **status**: `number` Defined in: [bee-js/src/types/index.ts:420](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L420) *** ### statusText? > `optional` **statusText**: `string` Defined in: [bee-js/src/types/index.ts:421](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L421) --- ## Interface: BeeVersions Defined in: [bee-js/src/types/debug.ts:123](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/debug.ts#L123) ## Properties ### beeApiVersion > **beeApiVersion**: `string` Defined in: [bee-js/src/types/debug.ts:127](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/debug.ts#L127) *** ### beeVersion > **beeVersion**: `string` Defined in: [bee-js/src/types/debug.ts:126](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/debug.ts#L126) *** ### supportedBeeApiVersion > **supportedBeeApiVersion**: `string` Defined in: [bee-js/src/types/debug.ts:125](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/debug.ts#L125) *** ### supportedBeeVersion > **supportedBeeVersion**: `string` Defined in: [bee-js/src/types/debug.ts:124](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/debug.ts#L124) --- ## Interface: Bin Defined in: [bee-js/src/types/debug.ts:202](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/debug.ts#L202) ## Properties ### connected > **connected**: `number` Defined in: [bee-js/src/types/debug.ts:204](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/debug.ts#L204) *** ### connectedPeers > **connectedPeers**: [`Peer`](Peer.md)[] Defined in: [bee-js/src/types/debug.ts:206](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/debug.ts#L206) *** ### disconnectedPeers > **disconnectedPeers**: [`Peer`](Peer.md)[] Defined in: [bee-js/src/types/debug.ts:205](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/debug.ts#L205) *** ### population > **population**: `number` Defined in: [bee-js/src/types/debug.ts:203](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/debug.ts#L203) --- ## Interface: CashoutResult Defined in: [bee-js/src/types/debug.ts:51](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/debug.ts#L51) ## Properties ### bounced > **bounced**: `boolean` Defined in: [bee-js/src/types/debug.ts:54](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/debug.ts#L54) *** ### lastPayout > **lastPayout**: [`BZZ`](../classes/BZZ.md) Defined in: [bee-js/src/types/debug.ts:53](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/debug.ts#L53) *** ### recipient > **recipient**: `string` Defined in: [bee-js/src/types/debug.ts:52](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/debug.ts#L52) --- ## Interface: ChainState Defined in: [bee-js/src/types/debug.ts:265](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/debug.ts#L265) ## Properties ### block > **block**: `number` Defined in: [bee-js/src/types/debug.ts:267](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/debug.ts#L267) *** ### chainTip > **chainTip**: `number` Defined in: [bee-js/src/types/debug.ts:266](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/debug.ts#L266) *** ### currentPrice > **currentPrice**: `number` Defined in: [bee-js/src/types/debug.ts:269](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/debug.ts#L269) *** ### minimumValidityBlocks? > `optional` **minimumValidityBlocks**: `number` Defined in: [bee-js/src/types/debug.ts:270](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/debug.ts#L270) *** ### totalAmount > **totalAmount**: [`NumberString`](../type-aliases/NumberString.md) Defined in: [bee-js/src/types/debug.ts:268](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/debug.ts#L268) --- ## Interface: Cheque Defined in: [bee-js/src/types/debug.ts:69](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/debug.ts#L69) ## Properties ### beneficiary > **beneficiary**: [`EthAddress`](../classes/EthAddress.md) Defined in: [bee-js/src/types/debug.ts:70](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/debug.ts#L70) *** ### chequebook > **chequebook**: [`EthAddress`](../classes/EthAddress.md) Defined in: [bee-js/src/types/debug.ts:71](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/debug.ts#L71) *** ### payout > **payout**: [`BZZ`](../classes/BZZ.md) Defined in: [bee-js/src/types/debug.ts:72](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/debug.ts#L72) --- ## Interface: ChequebookAddressResponse Defined in: [bee-js/src/types/debug.ts:30](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/debug.ts#L30) ## Properties ### chequebookAddress > **chequebookAddress**: [`EthAddress`](../classes/EthAddress.md) Defined in: [bee-js/src/types/debug.ts:31](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/debug.ts#L31) --- ## Interface: ChequebookBalanceResponse Defined in: [bee-js/src/types/debug.ts:34](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/debug.ts#L34) ## Properties ### availableBalance > **availableBalance**: [`BZZ`](../classes/BZZ.md) Defined in: [bee-js/src/types/debug.ts:36](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/debug.ts#L36) *** ### totalBalance > **totalBalance**: [`BZZ`](../classes/BZZ.md) Defined in: [bee-js/src/types/debug.ts:35](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/debug.ts#L35) --- ## Interface: Chunk Defined in: [core-sdk/src/chunk/cac.ts:25](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/chunk/cac.ts#L25) Content Addressed Chunk (CAC) - the immutable building block of Swarm, holding at most 4096 bytes of payload. - `span` indicates the size of the `payload` in bytes. - `payload` contains the actual data or the body of the chunk. - `data` contains the full chunk data - `span` and `payload`. - `address` is the Swarm hash (or reference) of the chunk. The `toSingleOwnerChunk` method allows converting the CAC into a Single Owner Chunk (SOC). ## Properties ### address > **address**: [`Reference`](../classes/Reference.md) Defined in: [core-sdk/src/chunk/cac.ts:29](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/chunk/cac.ts#L29) *** ### data > `readonly` **data**: `Uint8Array` Defined in: [core-sdk/src/chunk/cac.ts:26](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/chunk/cac.ts#L26) *** ### payload > **payload**: [`Bytes`](../classes/Bytes.md) Defined in: [core-sdk/src/chunk/cac.ts:28](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/chunk/cac.ts#L28) *** ### span > **span**: [`Span`](../classes/Span.md) Defined in: [core-sdk/src/chunk/cac.ts:27](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/chunk/cac.ts#L27) *** ### toSingleOwnerChunk() > **toSingleOwnerChunk**: (`identifier`, `privateKey`) => [`SingleOwnerChunk`](SingleOwnerChunk.md) Defined in: [core-sdk/src/chunk/cac.ts:34](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/chunk/cac.ts#L34) Converts this CAC into a Single Owner Chunk (SOC), signed by `privateKey` over `identifier` and this chunk's address. #### Parameters ##### identifier `string` | `Uint8Array`\<`ArrayBufferLike`\> | [`Identifier`](../classes/Identifier.md) ##### privateKey `string` | `Uint8Array`\<`ArrayBufferLike`\> | [`PrivateKey`](../classes/PrivateKey.md) #### Returns [`SingleOwnerChunk`](SingleOwnerChunk.md) --- ## Interface: ChunkUploadOptions Defined in: [bee-js/src/types/index.ts:172](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L172) ## Extends - `Omit`\<[`UploadOptions`](UploadOptions.md), `"act"` \| `"actHistoryAddress"`\> ## Properties ### ~~act?~~ > `optional` **act**: `boolean` Defined in: [bee-js/src/types/index.ts:174](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L174) #### Deprecated Bee ignores ACT on `/chunks` and `/soc`; this option will be removed. *** ### ~~actHistoryAddress?~~ > `optional` **actHistoryAddress**: `string` \| `Uint8Array`\<`ArrayBufferLike`\> \| [`Reference`](../classes/Reference.md) Defined in: [bee-js/src/types/index.ts:177](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L177) #### Deprecated Bee ignores ACT on `/chunks` and `/soc`; this option will be removed. *** ### deferred? > `optional` **deferred**: `boolean` Defined in: [bee-js/src/types/index.ts:169](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L169) Determines if the uploaded data should be sent to the network immediately (eq. deferred=false) or in a deferred fashion (eq. deferred=true). With deferred style client uploads all the data to Bee node first and only then Bee node starts push the data to network itself. The progress of this upload can be tracked with tags. With non-deferred style client uploads the data to Bee which immediately starts pushing the data to network. The request is only finished once all the data was pushed through the Bee node to the network. In future there will be move to the non-deferred style and even the support for deferred upload will be removed from Bee itself. #### Default ```ts true ``` #### Inherited from [`UploadOptions`](UploadOptions.md).[`deferred`](UploadOptions.md#deferred) *** ### encrypt? > `optional` **encrypt**: `boolean` Defined in: [bee-js/src/types/index.ts:148](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L148) Will encrypt the uploaded data and return longer hash which also includes the decryption key. #### See - [Bee docs - Store with Encryption](https://docs.ethswarm.org/docs/develop/access-the-swarm/store-with-encryption) - [Bee API reference - `POST /bzz`](https://docs.ethswarm.org/api/#tag/BZZ/paths/~1bzz/post) - Reference #### Inherited from [`UploadOptions`](UploadOptions.md).[`encrypt`](UploadOptions.md#encrypt) *** ### pin? > `optional` **pin**: `boolean` Defined in: [bee-js/src/types/index.ts:139](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L139) Will pin the data locally in the Bee node as well. Locally pinned data is possible to reupload to network if it disappear. #### See - [Bee docs - Pinning](https://docs.ethswarm.org/docs/develop/access-the-swarm/pinning) - [Bee API reference - `POST /bzz`](https://docs.ethswarm.org/api/#tag/BZZ/paths/~1bzz/post) #### Inherited from [`UploadOptions`](UploadOptions.md).[`pin`](UploadOptions.md#pin) *** ### tag? > `optional` **tag**: `number` Defined in: [bee-js/src/types/index.ts:157](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L157) Tags keep track of syncing the data with network. This option allows attach existing Tag UUID to the uploaded data. #### See - [Bee API reference - `POST /bzz`](https://docs.ethswarm.org/api/#tag/BZZ/paths/~1bzz/post) - [Bee docs - Syncing / Tags](https://docs.ethswarm.org/docs/develop/access-the-swarm/syncing) #### Link Tag #### Inherited from [`UploadOptions`](UploadOptions.md).[`tag`](UploadOptions.md#tag) --- ## Interface: CollectionEntry Defined in: [bee-js/src/types/index.ts:358](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L358) Object represents a file and some of its metadata in [[Directory]] object. ## Properties ### file? > `optional` **file**: `File` Defined in: [bee-js/src/types/index.ts:361](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L361) *** ### fsPath? > `optional` **fsPath**: `string` Defined in: [bee-js/src/types/index.ts:362](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L362) *** ### path > **path**: `string` Defined in: [bee-js/src/types/index.ts:359](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L359) *** ### size > **size**: `number` Defined in: [bee-js/src/types/index.ts:360](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L360) --- ## Interface: CollectionUploadOptions Defined in: [bee-js/src/types/index.ts:260](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L260) ## Extends - [`UploadOptions`](UploadOptions.md) ## Properties ### act? > `optional` **act**: `boolean` Defined in: [bee-js/src/types/index.ts:127](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L127) If set to true, an ACT will be created for the uploaded data. #### Inherited from [`UploadOptions`](UploadOptions.md).[`act`](UploadOptions.md#act) *** ### actHistoryAddress? > `optional` **actHistoryAddress**: `string` \| `Uint8Array`\<`ArrayBufferLike`\> \| [`Reference`](../classes/Reference.md) Defined in: [bee-js/src/types/index.ts:129](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L129) #### Inherited from [`UploadOptions`](UploadOptions.md).[`actHistoryAddress`](UploadOptions.md#acthistoryaddress) *** ### deferred? > `optional` **deferred**: `boolean` Defined in: [bee-js/src/types/index.ts:169](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L169) Determines if the uploaded data should be sent to the network immediately (eq. deferred=false) or in a deferred fashion (eq. deferred=true). With deferred style client uploads all the data to Bee node first and only then Bee node starts push the data to network itself. The progress of this upload can be tracked with tags. With non-deferred style client uploads the data to Bee which immediately starts pushing the data to network. The request is only finished once all the data was pushed through the Bee node to the network. In future there will be move to the non-deferred style and even the support for deferred upload will be removed from Bee itself. #### Default ```ts true ``` #### Inherited from [`UploadOptions`](UploadOptions.md).[`deferred`](UploadOptions.md#deferred) *** ### encrypt? > `optional` **encrypt**: `boolean` Defined in: [bee-js/src/types/index.ts:148](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L148) Will encrypt the uploaded data and return longer hash which also includes the decryption key. #### See - [Bee docs - Store with Encryption](https://docs.ethswarm.org/docs/develop/access-the-swarm/store-with-encryption) - [Bee API reference - `POST /bzz`](https://docs.ethswarm.org/api/#tag/BZZ/paths/~1bzz/post) - Reference #### Inherited from [`UploadOptions`](UploadOptions.md).[`encrypt`](UploadOptions.md#encrypt) *** ### errorDocument? > `optional` **errorDocument**: `string` Defined in: [bee-js/src/types/index.ts:275](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L275) Configure custom error document to be returned when a specified path can not be found in collection. #### See - [Bee docs - Upload a directory](https://docs.ethswarm.org/docs/develop/access-the-swarm/upload-and-download#upload-a-directory) - [Bee API reference - `POST /bzz`](https://docs.ethswarm.org/api/#tag/BZZ/paths/~1bzz/post) *** ### indexDocument? > `optional` **indexDocument**: `string` Defined in: [bee-js/src/types/index.ts:267](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L267) Default file to be returned when the root hash of collection is accessed. #### See - [Bee docs - Upload a directory](https://docs.ethswarm.org/docs/develop/access-the-swarm/upload-and-download#upload-a-directory) - [Bee API reference - `POST /bzz`](https://docs.ethswarm.org/api/#tag/BZZ/paths/~1bzz/post) *** ### pin? > `optional` **pin**: `boolean` Defined in: [bee-js/src/types/index.ts:139](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L139) Will pin the data locally in the Bee node as well. Locally pinned data is possible to reupload to network if it disappear. #### See - [Bee docs - Pinning](https://docs.ethswarm.org/docs/develop/access-the-swarm/pinning) - [Bee API reference - `POST /bzz`](https://docs.ethswarm.org/api/#tag/BZZ/paths/~1bzz/post) #### Inherited from [`UploadOptions`](UploadOptions.md).[`pin`](UploadOptions.md#pin) *** ### redundancyLevel? > `optional` **redundancyLevel**: [`RedundancyLevel`](../enumerations/RedundancyLevel.md) Defined in: [bee-js/src/types/index.ts:277](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L277) *** ### tag? > `optional` **tag**: `number` Defined in: [bee-js/src/types/index.ts:157](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L157) Tags keep track of syncing the data with network. This option allows attach existing Tag UUID to the uploaded data. #### See - [Bee API reference - `POST /bzz`](https://docs.ethswarm.org/api/#tag/BZZ/paths/~1bzz/post) - [Bee docs - Syncing / Tags](https://docs.ethswarm.org/docs/develop/access-the-swarm/syncing) #### Link Tag #### Inherited from [`UploadOptions`](UploadOptions.md).[`tag`](UploadOptions.md#tag) --- ## Interface: Data Defined in: [bee-js/src/types/index.ts:338](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L338) Helper interface that adds utility functions to work more conveniently with bytes in normal user scenarios. Concretely: text(), hex(), json() ## Extends - `Uint8Array` ## Indexable \[`index`: `number`\]: `number` ## Properties ### \[toStringTag\] > `readonly` **\[toStringTag\]**: `"Uint8Array"` Defined in: typescript/lib/lib.es2015.symbol.wellknown.d.ts:284 #### Inherited from `Uint8Array.[toStringTag]` *** ### buffer > `readonly` **buffer**: `ArrayBufferLike` Defined in: typescript/lib/lib.es5.d.ts:2174 The ArrayBuffer instance referenced by the array. #### Inherited from `Uint8Array.buffer` *** ### byteLength > `readonly` **byteLength**: `number` Defined in: typescript/lib/lib.es5.d.ts:2179 The length in bytes of the array. #### Inherited from `Uint8Array.byteLength` *** ### byteOffset > `readonly` **byteOffset**: `number` Defined in: typescript/lib/lib.es5.d.ts:2184 The offset in bytes of the array. #### Inherited from `Uint8Array.byteOffset` *** ### BYTES\_PER\_ELEMENT > `readonly` **BYTES\_PER\_ELEMENT**: `number` Defined in: typescript/lib/lib.es5.d.ts:2169 The size in bytes of each element in the array. #### Inherited from `Uint8Array.BYTES_PER_ELEMENT` *** ### length > `readonly` **length**: `number` Defined in: typescript/lib/lib.es5.d.ts:2283 The length of the array. #### Inherited from `Uint8Array.length` ## Methods ### \[iterator\]() > **\[iterator\]**(): `ArrayIterator`\<`number`\> Defined in: typescript/lib/lib.es2015.iterable.d.ts:313 #### Returns `ArrayIterator`\<`number`\> #### Inherited from `Uint8Array.[iterator]` *** ### copyWithin() > **copyWithin**(`target`, `start`, `end?`): `this` Defined in: typescript/lib/lib.es5.d.ts:2195 Returns the this object after copying a section of the array identified by start and end to the same array starting at position target #### Parameters ##### target `number` If target is negative, it is treated as length+target where length is the length of the array. ##### start `number` If start is negative, it is treated as length+start. If end is negative, it is treated as length+end. ##### end? `number` If not specified, length of the this object is used as its default value. #### Returns `this` #### Inherited from `Uint8Array.copyWithin` *** ### entries() > **entries**(): `ArrayIterator`\<\[`number`, `number`\]\> Defined in: typescript/lib/lib.es2015.iterable.d.ts:318 Returns an array of key, value pairs for every entry in the array #### Returns `ArrayIterator`\<\[`number`, `number`\]\> #### Inherited from `Uint8Array.entries` *** ### every() > **every**(`predicate`, `thisArg?`): `boolean` Defined in: typescript/lib/lib.es5.d.ts:2205 Determines whether all the members of an array satisfy the specified test. #### Parameters ##### predicate (`value`, `index`, `array`) => `unknown` A function that accepts up to three arguments. The every method calls the predicate function for each element in the array until the predicate returns a value which is coercible to the Boolean value false, or until the end of the array. ##### thisArg? `any` An object to which the this keyword can refer in the predicate function. If thisArg is omitted, undefined is used as the this value. #### Returns `boolean` #### Inherited from `Uint8Array.every` *** ### fill() > **fill**(`value`, `start?`, `end?`): `this` Defined in: typescript/lib/lib.es5.d.ts:2215 Changes all array elements from `start` to `end` index to a static `value` and returns the modified array #### Parameters ##### value `number` value to fill array section with ##### start? `number` index to start filling the array at. If start is negative, it is treated as length+start where length is the length of the array. ##### end? `number` index to stop filling the array at. If end is negative, it is treated as length+end. #### Returns `this` #### Inherited from `Uint8Array.fill` *** ### filter() > **filter**(`predicate`, `thisArg?`): `Uint8Array`\<`ArrayBuffer`\> Defined in: typescript/lib/lib.es5.d.ts:2224 Returns the elements of an array that meet the condition specified in a callback function. #### Parameters ##### predicate (`value`, `index`, `array`) => `any` A function that accepts up to three arguments. The filter method calls the predicate function one time for each element in the array. ##### thisArg? `any` An object to which the this keyword can refer in the predicate function. If thisArg is omitted, undefined is used as the this value. #### Returns `Uint8Array`\<`ArrayBuffer`\> #### Inherited from `Uint8Array.filter` *** ### find() > **find**(`predicate`, `thisArg?`): `number` \| `undefined` Defined in: typescript/lib/lib.es5.d.ts:2235 Returns the value of the first element in the array where predicate is true, and undefined otherwise. #### Parameters ##### predicate (`value`, `index`, `obj`) => `boolean` find calls predicate once for each element of the array, in ascending order, until it finds one where predicate returns true. If such an element is found, find immediately returns that element value. Otherwise, find returns undefined. ##### thisArg? `any` If provided, it will be used as the this value for each invocation of predicate. If it is not provided, undefined is used instead. #### Returns `number` \| `undefined` #### Inherited from `Uint8Array.find` *** ### findIndex() > **findIndex**(`predicate`, `thisArg?`): `number` Defined in: typescript/lib/lib.es5.d.ts:2246 Returns the index of the first element in the array where predicate is true, and -1 otherwise. #### Parameters ##### predicate (`value`, `index`, `obj`) => `boolean` find calls predicate once for each element of the array, in ascending order, until it finds one where predicate returns true. If such an element is found, findIndex immediately returns that element index. Otherwise, findIndex returns -1. ##### thisArg? `any` If provided, it will be used as the this value for each invocation of predicate. If it is not provided, undefined is used instead. #### Returns `number` #### Inherited from `Uint8Array.findIndex` *** ### forEach() > **forEach**(`callbackfn`, `thisArg?`): `void` Defined in: typescript/lib/lib.es5.d.ts:2255 Performs the specified action for each element in an array. #### Parameters ##### callbackfn (`value`, `index`, `array`) => `void` A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the array. ##### thisArg? `any` An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. #### Returns `void` #### Inherited from `Uint8Array.forEach` *** ### hex() > **hex**(): `string` Defined in: [bee-js/src/types/index.ts:347](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L347) Converts the binary data into hex-string. #### Returns `string` *** ### includes() > **includes**(`searchElement`, `fromIndex?`): `boolean` Defined in: typescript/lib/lib.es2016.array.include.d.ts:52 Determines whether an array includes a certain element, returning true or false as appropriate. #### Parameters ##### searchElement `number` The element to search for. ##### fromIndex? `number` The position in this array at which to begin searching for searchElement. #### Returns `boolean` #### Inherited from `Uint8Array.includes` *** ### indexOf() > **indexOf**(`searchElement`, `fromIndex?`): `number` Defined in: typescript/lib/lib.es5.d.ts:2263 Returns the index of the first occurrence of a value in an array. #### Parameters ##### searchElement `number` The value to locate in the array. ##### fromIndex? `number` The array index at which to begin the search. If fromIndex is omitted, the search starts at index 0. #### Returns `number` #### Inherited from `Uint8Array.indexOf` *** ### join() > **join**(`separator?`): `string` Defined in: typescript/lib/lib.es5.d.ts:2270 Adds all the elements of an array separated by the specified separator string. #### Parameters ##### separator? `string` A string used to separate one element of an array from the next in the resulting String. If omitted, the array elements are separated with a comma. #### Returns `string` #### Inherited from `Uint8Array.join` *** ### json() > **json**(): `Record`\<`string`, `unknown`\> Defined in: [bee-js/src/types/index.ts:352](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L352) Converts the binary data into string which is then parsed into JSON. #### Returns `Record`\<`string`, `unknown`\> *** ### keys() > **keys**(): `ArrayIterator`\<`number`\> Defined in: typescript/lib/lib.es2015.iterable.d.ts:323 Returns an list of keys in the array #### Returns `ArrayIterator`\<`number`\> #### Inherited from `Uint8Array.keys` *** ### lastIndexOf() > **lastIndexOf**(`searchElement`, `fromIndex?`): `number` Defined in: typescript/lib/lib.es5.d.ts:2278 Returns the index of the last occurrence of a value in an array. #### Parameters ##### searchElement `number` The value to locate in the array. ##### fromIndex? `number` The array index at which to begin the search. If fromIndex is omitted, the search starts at index 0. #### Returns `number` #### Inherited from `Uint8Array.lastIndexOf` *** ### map() > **map**(`callbackfn`, `thisArg?`): `Uint8Array`\<`ArrayBuffer`\> Defined in: typescript/lib/lib.es5.d.ts:2293 Calls a defined callback function on each element of an array, and returns an array that contains the results. #### Parameters ##### callbackfn (`value`, `index`, `array`) => `number` A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array. ##### thisArg? `any` An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. #### Returns `Uint8Array`\<`ArrayBuffer`\> #### Inherited from `Uint8Array.map` *** ### reduce() #### Call Signature > **reduce**(`callbackfn`): `number` Defined in: typescript/lib/lib.es5.d.ts:2305 Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. ##### Parameters ###### callbackfn (`previousValue`, `currentValue`, `currentIndex`, `array`) => `number` A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array. ##### Returns `number` ##### Inherited from `Uint8Array.reduce` #### Call Signature > **reduce**(`callbackfn`, `initialValue`): `number` Defined in: typescript/lib/lib.es5.d.ts:2306 ##### Parameters ###### callbackfn (`previousValue`, `currentValue`, `currentIndex`, `array`) => `number` ###### initialValue `number` ##### Returns `number` ##### Inherited from `Uint8Array.reduce` #### Call Signature > **reduce**\<`U`\>(`callbackfn`, `initialValue`): `U` Defined in: typescript/lib/lib.es5.d.ts:2318 Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. ##### Type Parameters ###### U `U` ##### Parameters ###### callbackfn (`previousValue`, `currentValue`, `currentIndex`, `array`) => `U` A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array. ###### initialValue `U` If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. ##### Returns `U` ##### Inherited from `Uint8Array.reduce` *** ### reduceRight() #### Call Signature > **reduceRight**(`callbackfn`): `number` Defined in: typescript/lib/lib.es5.d.ts:2330 Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. ##### Parameters ###### callbackfn (`previousValue`, `currentValue`, `currentIndex`, `array`) => `number` A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array. ##### Returns `number` ##### Inherited from `Uint8Array.reduceRight` #### Call Signature > **reduceRight**(`callbackfn`, `initialValue`): `number` Defined in: typescript/lib/lib.es5.d.ts:2331 ##### Parameters ###### callbackfn (`previousValue`, `currentValue`, `currentIndex`, `array`) => `number` ###### initialValue `number` ##### Returns `number` ##### Inherited from `Uint8Array.reduceRight` #### Call Signature > **reduceRight**\<`U`\>(`callbackfn`, `initialValue`): `U` Defined in: typescript/lib/lib.es5.d.ts:2343 Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. ##### Type Parameters ###### U `U` ##### Parameters ###### callbackfn (`previousValue`, `currentValue`, `currentIndex`, `array`) => `U` A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array. ###### initialValue `U` If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. ##### Returns `U` ##### Inherited from `Uint8Array.reduceRight` *** ### reverse() > **reverse**(): `this` Defined in: typescript/lib/lib.es5.d.ts:2348 Reverses the elements in an Array. #### Returns `this` #### Inherited from `Uint8Array.reverse` *** ### set() > **set**(`array`, `offset?`): `void` Defined in: typescript/lib/lib.es5.d.ts:2355 Sets a value or an array of values. #### Parameters ##### array `ArrayLike`\<`number`\> A typed or untyped array of values to set. ##### offset? `number` The index in the current array at which the values are to be written. #### Returns `void` #### Inherited from `Uint8Array.set` *** ### slice() > **slice**(`start?`, `end?`): `Uint8Array`\<`ArrayBuffer`\> Defined in: typescript/lib/lib.es5.d.ts:2362 Returns a section of an array. #### Parameters ##### start? `number` The beginning of the specified portion of the array. ##### end? `number` The end of the specified portion of the array. This is exclusive of the element at the index 'end'. #### Returns `Uint8Array`\<`ArrayBuffer`\> #### Inherited from `Uint8Array.slice` *** ### some() > **some**(`predicate`, `thisArg?`): `boolean` Defined in: typescript/lib/lib.es5.d.ts:2372 Determines whether the specified callback function returns true for any element of an array. #### Parameters ##### predicate (`value`, `index`, `array`) => `unknown` A function that accepts up to three arguments. The some method calls the predicate function for each element in the array until the predicate returns a value which is coercible to the Boolean value true, or until the end of the array. ##### thisArg? `any` An object to which the this keyword can refer in the predicate function. If thisArg is omitted, undefined is used as the this value. #### Returns `boolean` #### Inherited from `Uint8Array.some` *** ### sort() > **sort**(`compareFn?`): `this` Defined in: typescript/lib/lib.es5.d.ts:2383 Sorts an array. #### Parameters ##### compareFn? (`a`, `b`) => `number` Function used to determine the order of the elements. It is expected to return a negative value if first argument is less than second argument, zero if they're equal and a positive value otherwise. If omitted, the elements are sorted in ascending order. ```ts [11,2,22,1].sort((a, b) => a - b) ``` #### Returns `this` #### Inherited from `Uint8Array.sort` *** ### subarray() > **subarray**(`begin?`, `end?`): `Uint8Array`\<`ArrayBufferLike`\> Defined in: typescript/lib/lib.es5.d.ts:2391 Gets a new Uint8Array view of the ArrayBuffer store for this array, referencing the elements at begin, inclusive, up to end, exclusive. #### Parameters ##### begin? `number` The index of the beginning of the array. ##### end? `number` The index of the end of the array. #### Returns `Uint8Array`\<`ArrayBufferLike`\> #### Inherited from `Uint8Array.subarray` *** ### text() > **text**(): `string` Defined in: [bee-js/src/types/index.ts:342](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L342) Converts the binary data using UTF-8 decoding into string. #### Returns `string` *** ### toLocaleString() #### Call Signature > **toLocaleString**(): `string` Defined in: typescript/lib/lib.es5.d.ts:2396 Converts a number to a string by using the current locale. ##### Returns `string` ##### Inherited from `Uint8Array.toLocaleString` #### Call Signature > **toLocaleString**(`locales`, `options?`): `string` Defined in: typescript/lib/lib.es2015.core.d.ts:568 ##### Parameters ###### locales `string` | `string`[] ###### options? `NumberFormatOptions` ##### Returns `string` ##### Inherited from `Uint8Array.toLocaleString` *** ### toString() > **toString**(): `string` Defined in: typescript/lib/lib.es5.d.ts:2401 Returns a string representation of an array. #### Returns `string` #### Inherited from `Uint8Array.toString` *** ### valueOf() > **valueOf**(): `this` Defined in: typescript/lib/lib.es5.d.ts:2404 Returns the primitive value of the specified object. #### Returns `this` #### Inherited from `Uint8Array.valueOf` *** ### values() > **values**(): `ArrayIterator`\<`number`\> Defined in: typescript/lib/lib.es2015.iterable.d.ts:328 Returns an list of values in the array #### Returns `ArrayIterator`\<`number`\> #### Inherited from `Uint8Array.values` --- ## Interface: DebugStatus Defined in: [bee-js/src/types/debug.ts:94](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/debug.ts#L94) ## Properties ### batchCommitment > **batchCommitment**: `number` Defined in: [bee-js/src/types/debug.ts:104](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/debug.ts#L104) *** ### beeMode > **beeMode**: [`BeeModes`](../enumerations/BeeModes.md) Defined in: [bee-js/src/types/debug.ts:97](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/debug.ts#L97) *** ### committedDepth > **committedDepth**: `number` Defined in: [bee-js/src/types/debug.ts:107](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/debug.ts#L107) *** ### connectedPeers > **connectedPeers**: `number` Defined in: [bee-js/src/types/debug.ts:102](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/debug.ts#L102) *** ### isReachable > **isReachable**: `boolean` Defined in: [bee-js/src/types/debug.ts:105](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/debug.ts#L105) *** ### isWarmingUp > **isWarmingUp**: `boolean` Defined in: [bee-js/src/types/debug.ts:108](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/debug.ts#L108) *** ### lastSyncedBlock > **lastSyncedBlock**: `number` Defined in: [bee-js/src/types/debug.ts:106](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/debug.ts#L106) *** ### neighborhoodSize > **neighborhoodSize**: `number` Defined in: [bee-js/src/types/debug.ts:103](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/debug.ts#L103) *** ### overlay > **overlay**: `string` Defined in: [bee-js/src/types/debug.ts:95](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/debug.ts#L95) *** ### proximity > **proximity**: `number` Defined in: [bee-js/src/types/debug.ts:96](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/debug.ts#L96) *** ### pullsyncRate > **pullsyncRate**: `number` Defined in: [bee-js/src/types/debug.ts:100](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/debug.ts#L100) *** ### reserveSize > **reserveSize**: `number` Defined in: [bee-js/src/types/debug.ts:98](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/debug.ts#L98) *** ### reserveSizeWithinRadius > **reserveSizeWithinRadius**: `number` Defined in: [bee-js/src/types/debug.ts:99](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/debug.ts#L99) *** ### storageRadius > **storageRadius**: `number` Defined in: [bee-js/src/types/debug.ts:101](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/debug.ts#L101) --- ## Interface: DownloadOptions Defined in: [bee-js/src/types/index.ts:213](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L213) ## Properties ### actHistoryAddress? > `optional` **actHistoryAddress**: `string` \| `Uint8Array`\<`ArrayBufferLike`\> \| [`Reference`](../classes/Reference.md) Defined in: [bee-js/src/types/index.ts:237](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L237) *** ### actPublisher? > `optional` **actPublisher**: `string` \| `Uint8Array`\<`ArrayBufferLike`\> \| [`PublicKey`](../classes/PublicKey.md) Defined in: [bee-js/src/types/index.ts:235](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L235) *** ### actTimestamp? > `optional` **actTimestamp**: `string` \| `number` Defined in: [bee-js/src/types/index.ts:239](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L239) *** ### fallback? > `optional` **fallback**: `boolean` Defined in: [bee-js/src/types/index.ts:226](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L226) Specify if the retrieve strategies (chunk prefetching on redundant data) are used in a fallback cascade. The default is true. Only applicable for erasure coded data. *** ### redundancyStrategy? > `optional` **redundancyStrategy**: [`RedundancyStrategy`](../enumerations/RedundancyStrategy.md) Defined in: [bee-js/src/types/index.ts:219](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L219) Specify the retrieve strategy on redundant data. Only applicable for erasure coded data. *** ### timeoutMs? > `optional` **timeoutMs**: `number` Defined in: [bee-js/src/types/index.ts:233](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L233) Specify the timeout for chunk retrieval. The default is 30 seconds. This is not the timeout for the whole download operation, but rather for each chunk retrieval. --- ## Interface: Envelope Defined in: [core-sdk/src/stamper/marshal.ts:7](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/stamper/marshal.ts#L7) A postage stamp's fields, as produced by signing (e.g. via `stamp()`). ## Extended by - [`EnvelopeWithBatchId`](EnvelopeWithBatchId.md) ## Properties ### index > **index**: `Uint8Array` Defined in: [core-sdk/src/stamper/marshal.ts:9](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/stamper/marshal.ts#L9) *** ### issuer > **issuer**: [`EthAddress`](../classes/EthAddress.md) Defined in: [core-sdk/src/stamper/marshal.ts:8](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/stamper/marshal.ts#L8) *** ### signature > **signature**: [`Signature`](../classes/Signature.md) Defined in: [core-sdk/src/stamper/marshal.ts:11](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/stamper/marshal.ts#L11) *** ### timestamp > **timestamp**: `Uint8Array` Defined in: [core-sdk/src/stamper/marshal.ts:10](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/stamper/marshal.ts#L10) --- ## Interface: EnvelopeWithBatchId Defined in: [core-sdk/src/stamper/marshal.ts:15](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/stamper/marshal.ts#L15) An [Envelope](Envelope.md) with its batch ID, ready to marshal. ## Extends - [`Envelope`](Envelope.md) ## Properties ### batchId > **batchId**: [`BatchId`](../classes/BatchId.md) Defined in: [core-sdk/src/stamper/marshal.ts:16](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/stamper/marshal.ts#L16) *** ### index > **index**: `Uint8Array` Defined in: [core-sdk/src/stamper/marshal.ts:9](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/stamper/marshal.ts#L9) #### Inherited from [`Envelope`](Envelope.md).[`index`](Envelope.md#index) *** ### issuer > **issuer**: [`EthAddress`](../classes/EthAddress.md) Defined in: [core-sdk/src/stamper/marshal.ts:8](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/stamper/marshal.ts#L8) #### Inherited from [`Envelope`](Envelope.md).[`issuer`](Envelope.md#issuer) *** ### signature > **signature**: [`Signature`](../classes/Signature.md) Defined in: [core-sdk/src/stamper/marshal.ts:11](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/stamper/marshal.ts#L11) #### Inherited from [`Envelope`](Envelope.md).[`signature`](Envelope.md#signature) *** ### timestamp > **timestamp**: `Uint8Array` Defined in: [core-sdk/src/stamper/marshal.ts:10](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/stamper/marshal.ts#L10) #### Inherited from [`Envelope`](Envelope.md).[`timestamp`](Envelope.md#timestamp) --- ## Interface: FeedReader Defined in: [bee-js/src/types/index.ts:428](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L428) FeedReader is an interface for downloading feed updates ## Extended by - [`FeedWriter`](FeedWriter.md) ## Properties ### owner > `readonly` **owner**: [`EthAddress`](../classes/EthAddress.md) Defined in: [bee-js/src/types/index.ts:429](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L429) *** ### topic > `readonly` **topic**: [`Topic`](../classes/Topic.md) Defined in: [bee-js/src/types/index.ts:430](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L430) ## Methods ### ~~download()~~ > **download**(`options?`): `Promise`\<`FeedPayloadResult`\> Defined in: [bee-js/src/types/index.ts:435](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L435) #### Parameters ##### options? `FeedUpdateOptions` #### Returns `Promise`\<`FeedPayloadResult`\> #### Deprecated Use `downloadReference` or `downloadPayload` instead to disambiguate how the data should be interpreted. *** ### downloadPayload() > **downloadPayload**(`options?`): `Promise`\<`FeedPayloadResult`\> Defined in: [bee-js/src/types/index.ts:445](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L445) Downloads the feed update (latest if no index is specified) and returns it as a payload. #### Parameters ##### options? `FeedUpdateOptions` #### Returns `Promise`\<`FeedPayloadResult`\> *** ### downloadReference() > **downloadReference**(`options?`): `Promise`\<`FeedReferenceResult`\> Defined in: [bee-js/src/types/index.ts:440](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L440) Downloads the feed update (latest if no index is specified) and returns it as a reference. #### Parameters ##### options? `FeedUpdateOptions` #### Returns `Promise`\<`FeedReferenceResult`\> --- ## Interface: FeedWriter Defined in: [bee-js/src/types/index.ts:451](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L451) FeedWriter is an interface for updating feeds ## Extends - [`FeedReader`](FeedReader.md) ## Properties ### owner > `readonly` **owner**: [`EthAddress`](../classes/EthAddress.md) Defined in: [bee-js/src/types/index.ts:429](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L429) #### Inherited from [`FeedReader`](FeedReader.md).[`owner`](FeedReader.md#owner) *** ### topic > `readonly` **topic**: [`Topic`](../classes/Topic.md) Defined in: [bee-js/src/types/index.ts:430](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L430) #### Inherited from [`FeedReader`](FeedReader.md).[`topic`](FeedReader.md#topic) ## Methods ### ~~download()~~ > **download**(`options?`): `Promise`\<`FeedPayloadResult`\> Defined in: [bee-js/src/types/index.ts:435](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L435) #### Parameters ##### options? `FeedUpdateOptions` #### Returns `Promise`\<`FeedPayloadResult`\> #### Deprecated Use `downloadReference` or `downloadPayload` instead to disambiguate how the data should be interpreted. #### Inherited from [`FeedReader`](FeedReader.md).[`download`](FeedReader.md#download) *** ### downloadPayload() > **downloadPayload**(`options?`): `Promise`\<`FeedPayloadResult`\> Defined in: [bee-js/src/types/index.ts:445](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L445) Downloads the feed update (latest if no index is specified) and returns it as a payload. #### Parameters ##### options? `FeedUpdateOptions` #### Returns `Promise`\<`FeedPayloadResult`\> #### Inherited from [`FeedReader`](FeedReader.md).[`downloadPayload`](FeedReader.md#downloadpayload) *** ### downloadReference() > **downloadReference**(`options?`): `Promise`\<`FeedReferenceResult`\> Defined in: [bee-js/src/types/index.ts:440](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L440) Downloads the feed update (latest if no index is specified) and returns it as a reference. #### Parameters ##### options? `FeedUpdateOptions` #### Returns `Promise`\<`FeedReferenceResult`\> #### Inherited from [`FeedReader`](FeedReader.md).[`downloadReference`](FeedReader.md#downloadreference) *** ### ~~upload()~~ > **upload**(`postageBatchId`, `reference`, `options?`): `Promise`\<[`UploadResult`](UploadResult.md)\> Defined in: [bee-js/src/types/index.ts:463](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L463) Upload a new feed update #### Parameters ##### postageBatchId Postage BatchId to be used to upload the data with `string` | [`BatchId`](../classes/BatchId.md) ##### reference The reference to be stored in the new update `string` | `Uint8Array`\<`ArrayBufferLike`\> | [`Reference`](../classes/Reference.md) ##### options? `FeedUploadOptions` Additional options like `at` #### Returns `Promise`\<[`UploadResult`](UploadResult.md)\> UpdateResult that points at Single Owner Chunk that contains the new update and pointer to the updated chunk reference. #### Deprecated Use `uploadReference` or `uploadPayload` instead to disambiguate how the data should be interpreted. *** ### uploadPayload() > **uploadPayload**(`postageBatchId`, `payload`, `options?`): `Promise`\<[`UploadResult`](UploadResult.md)\> Defined in: [bee-js/src/types/index.ts:475](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L475) #### Parameters ##### postageBatchId `string` | [`BatchId`](../classes/BatchId.md) ##### payload `string` | `Uint8Array`\<`ArrayBufferLike`\> ##### options? `FeedUploadOptions` #### Returns `Promise`\<[`UploadResult`](UploadResult.md)\> *** ### uploadReference() > **uploadReference**(`postageBatchId`, `reference`, `options?`): `Promise`\<[`UploadResult`](UploadResult.md)\> Defined in: [bee-js/src/types/index.ts:469](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L469) #### Parameters ##### postageBatchId `string` | [`BatchId`](../classes/BatchId.md) ##### reference `string` | `Uint8Array`\<`ArrayBufferLike`\> | [`Reference`](../classes/Reference.md) ##### options? `FeedUploadOptions` #### Returns `Promise`\<[`UploadResult`](UploadResult.md)\> --- ## Interface: FileData # Interface: FileData\ Defined in: [bee-js/src/types/index.ts:319](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L319) ## Extends - [`FileHeaders`](FileHeaders.md) ## Type Parameters ### T `T` ## Properties ### contentType? > `optional` **contentType**: `string` Defined in: [bee-js/src/types/index.ts:316](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L316) #### Inherited from [`FileHeaders`](FileHeaders.md).[`contentType`](FileHeaders.md#contenttype) *** ### data > **data**: `T` Defined in: [bee-js/src/types/index.ts:320](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L320) *** ### name? > `optional` **name**: `string` Defined in: [bee-js/src/types/index.ts:314](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L314) #### Inherited from [`FileHeaders`](FileHeaders.md).[`name`](FileHeaders.md#name) *** ### tagUid? > `optional` **tagUid**: `number` Defined in: [bee-js/src/types/index.ts:315](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L315) #### Inherited from [`FileHeaders`](FileHeaders.md).[`tagUid`](FileHeaders.md#taguid) --- ## Interface: FileHeaders Defined in: [bee-js/src/types/index.ts:313](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L313) ## Extended by - [`FileData`](FileData.md) ## Properties ### contentType? > `optional` **contentType**: `string` Defined in: [bee-js/src/types/index.ts:316](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L316) *** ### name? > `optional` **name**: `string` Defined in: [bee-js/src/types/index.ts:314](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L314) *** ### tagUid? > `optional` **tagUid**: `number` Defined in: [bee-js/src/types/index.ts:315](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L315) --- ## Interface: FileUploadOptions Defined in: [bee-js/src/types/index.ts:242](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L242) ## Extends - [`UploadOptions`](UploadOptions.md) ## Properties ### act? > `optional` **act**: `boolean` Defined in: [bee-js/src/types/index.ts:127](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L127) If set to true, an ACT will be created for the uploaded data. #### Inherited from [`UploadOptions`](UploadOptions.md).[`act`](UploadOptions.md#act) *** ### actHistoryAddress? > `optional` **actHistoryAddress**: `string` \| `Uint8Array`\<`ArrayBufferLike`\> \| [`Reference`](../classes/Reference.md) Defined in: [bee-js/src/types/index.ts:129](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L129) #### Inherited from [`UploadOptions`](UploadOptions.md).[`actHistoryAddress`](UploadOptions.md#acthistoryaddress) *** ### contentType? > `optional` **contentType**: `string` Defined in: [bee-js/src/types/index.ts:255](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L255) Specifies given Content-Type so when loaded in browser the file is correctly represented. #### See [Bee API reference - `POST /bzz`](https://docs.ethswarm.org/api/#tag/BZZ/paths/~1bzz/post) *** ### deferred? > `optional` **deferred**: `boolean` Defined in: [bee-js/src/types/index.ts:169](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L169) Determines if the uploaded data should be sent to the network immediately (eq. deferred=false) or in a deferred fashion (eq. deferred=true). With deferred style client uploads all the data to Bee node first and only then Bee node starts push the data to network itself. The progress of this upload can be tracked with tags. With non-deferred style client uploads the data to Bee which immediately starts pushing the data to network. The request is only finished once all the data was pushed through the Bee node to the network. In future there will be move to the non-deferred style and even the support for deferred upload will be removed from Bee itself. #### Default ```ts true ``` #### Inherited from [`UploadOptions`](UploadOptions.md).[`deferred`](UploadOptions.md#deferred) *** ### encrypt? > `optional` **encrypt**: `boolean` Defined in: [bee-js/src/types/index.ts:148](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L148) Will encrypt the uploaded data and return longer hash which also includes the decryption key. #### See - [Bee docs - Store with Encryption](https://docs.ethswarm.org/docs/develop/access-the-swarm/store-with-encryption) - [Bee API reference - `POST /bzz`](https://docs.ethswarm.org/api/#tag/BZZ/paths/~1bzz/post) - Reference #### Inherited from [`UploadOptions`](UploadOptions.md).[`encrypt`](UploadOptions.md#encrypt) *** ### pin? > `optional` **pin**: `boolean` Defined in: [bee-js/src/types/index.ts:139](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L139) Will pin the data locally in the Bee node as well. Locally pinned data is possible to reupload to network if it disappear. #### See - [Bee docs - Pinning](https://docs.ethswarm.org/docs/develop/access-the-swarm/pinning) - [Bee API reference - `POST /bzz`](https://docs.ethswarm.org/api/#tag/BZZ/paths/~1bzz/post) #### Inherited from [`UploadOptions`](UploadOptions.md).[`pin`](UploadOptions.md#pin) *** ### redundancyLevel? > `optional` **redundancyLevel**: [`RedundancyLevel`](../enumerations/RedundancyLevel.md) Defined in: [bee-js/src/types/index.ts:257](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L257) *** ### size? > `optional` **size**: `number` Defined in: [bee-js/src/types/index.ts:248](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L248) Specifies Content-Length for the given data. It is required when uploading with Readable. #### See [Bee API reference - `POST /bzz`](https://docs.ethswarm.org/api/#tag/BZZ/paths/~1bzz/post) *** ### tag? > `optional` **tag**: `number` Defined in: [bee-js/src/types/index.ts:157](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L157) Tags keep track of syncing the data with network. This option allows attach existing Tag UUID to the uploaded data. #### See - [Bee API reference - `POST /bzz`](https://docs.ethswarm.org/api/#tag/BZZ/paths/~1bzz/post) - [Bee docs - Syncing / Tags](https://docs.ethswarm.org/docs/develop/access-the-swarm/syncing) #### Link Tag #### Inherited from [`UploadOptions`](UploadOptions.md).[`tag`](UploadOptions.md#tag) --- ## Interface: GetGranteesResult Defined in: [bee-js/src/types/index.ts:97](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L97) ## Properties ### grantees > **grantees**: [`PublicKey`](../classes/PublicKey.md)[] Defined in: [bee-js/src/types/index.ts:100](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L100) *** ### status > **status**: `number` Defined in: [bee-js/src/types/index.ts:98](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L98) *** ### statusText > **statusText**: `string` Defined in: [bee-js/src/types/index.ts:99](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L99) --- ## Interface: GlobalPostageBatch Defined in: [bee-js/src/types/index.ts:514](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L514) ## Properties ### batchID > **batchID**: [`BatchId`](../classes/BatchId.md) Defined in: [bee-js/src/types/index.ts:515](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L515) *** ### batchTTL > **batchTTL**: `number` Defined in: [bee-js/src/types/index.ts:522](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L522) *** ### bucketDepth > **bucketDepth**: `number` Defined in: [bee-js/src/types/index.ts:520](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L520) *** ### depth > **depth**: `number` Defined in: [bee-js/src/types/index.ts:519](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L519) *** ### immutable > **immutable**: `boolean` Defined in: [bee-js/src/types/index.ts:521](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L521) *** ### owner > **owner**: [`EthAddress`](../classes/EthAddress.md) Defined in: [bee-js/src/types/index.ts:518](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L518) *** ### start > **start**: `number` Defined in: [bee-js/src/types/index.ts:517](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L517) *** ### value > **value**: [`NumberString`](../type-aliases/NumberString.md) Defined in: [bee-js/src/types/index.ts:516](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L516) --- ## Interface: GranteesResult Defined in: [bee-js/src/types/index.ts:90](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L90) ## Properties ### historyref > **historyref**: [`Reference`](../classes/Reference.md) Defined in: [bee-js/src/types/index.ts:94](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L94) *** ### ref > **ref**: [`Reference`](../classes/Reference.md) Defined in: [bee-js/src/types/index.ts:93](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L93) *** ### status > **status**: `number` Defined in: [bee-js/src/types/index.ts:91](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L91) *** ### statusText > **statusText**: `string` Defined in: [bee-js/src/types/index.ts:92](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L92) --- ## Interface: GsocMessageHandler Defined in: [bee-js/src/types/index.ts:386](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L386) ## Properties ### onClose() > **onClose**: (`subscription`) => `void` Defined in: [bee-js/src/types/index.ts:389](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L389) #### Parameters ##### subscription [`GsocSubscription`](GsocSubscription.md) #### Returns `void` *** ### onError() > **onError**: (`error`, `subscription`) => `void` Defined in: [bee-js/src/types/index.ts:388](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L388) #### Parameters ##### error [`BeeError`](../classes/BeeError.md) ##### subscription [`GsocSubscription`](GsocSubscription.md) #### Returns `void` *** ### onMessage() > **onMessage**: (`message`, `subscription`) => `void` Defined in: [bee-js/src/types/index.ts:387](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L387) #### Parameters ##### message [`Bytes`](../classes/Bytes.md) ##### subscription [`GsocSubscription`](GsocSubscription.md) #### Returns `void` --- ## Interface: GsocSubscribeOptions Defined in: [bee-js/src/types/index.ts:395](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L395) ## Properties ### cacheWrappedChunk? > `optional` **cacheWrappedChunk**: `boolean` Defined in: [bee-js/src/types/index.ts:400](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L400) Caches each message's wrapped chunk on the node so it can be read through the bytes endpoint. *** ### fields? > `optional` **fields**: [`GsocField`](../type-aliases/GsocField.md)[] Defined in: [bee-js/src/types/index.ts:397](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L397) SOC fields concatenated into each message in this order; `payload` is variable length, so put it last. --- ## Interface: GsocSubscription Defined in: [bee-js/src/types/index.ts:381](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L381) ## Properties ### address > `readonly` **address**: [`EthAddress`](../classes/EthAddress.md) Defined in: [bee-js/src/types/index.ts:382](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L382) *** ### cancel() > **cancel**: () => `void` Defined in: [bee-js/src/types/index.ts:383](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L383) #### Returns `void` --- ## Interface: Health Defined in: [bee-js/src/types/debug.ts:111](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/debug.ts#L111) ## Properties ### apiVersion > **apiVersion**: `string` Defined in: [bee-js/src/types/debug.ts:114](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/debug.ts#L114) *** ### status > **status**: `"ok"` Defined in: [bee-js/src/types/debug.ts:112](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/debug.ts#L112) *** ### version > **version**: `string` Defined in: [bee-js/src/types/debug.ts:113](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/debug.ts#L113) --- ## Interface: LastCashoutActionResponse Defined in: [bee-js/src/types/debug.ts:57](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/debug.ts#L57) ## Properties ### lastCashedCheque > **lastCashedCheque**: [`Cheque`](Cheque.md) \| `null` Defined in: [bee-js/src/types/debug.ts:61](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/debug.ts#L61) *** ### peer > **peer**: `string` Defined in: [bee-js/src/types/debug.ts:58](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/debug.ts#L58) *** ### result > **result**: [`CashoutResult`](CashoutResult.md) \| `null` Defined in: [bee-js/src/types/debug.ts:62](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/debug.ts#L62) *** ### transactionHash > **transactionHash**: `string` \| `null` Defined in: [bee-js/src/types/debug.ts:60](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/debug.ts#L60) *** ### uncashedAmount > **uncashedAmount**: [`BZZ`](../classes/BZZ.md) Defined in: [bee-js/src/types/debug.ts:59](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/debug.ts#L59) --- ## Interface: LastChequesForPeerResponse Defined in: [bee-js/src/types/debug.ts:75](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/debug.ts#L75) ## Properties ### lastreceived > **lastreceived**: [`Cheque`](Cheque.md) \| `null` Defined in: [bee-js/src/types/debug.ts:77](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/debug.ts#L77) *** ### lastsent > **lastsent**: [`Cheque`](Cheque.md) \| `null` Defined in: [bee-js/src/types/debug.ts:78](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/debug.ts#L78) *** ### peer > **peer**: `string` Defined in: [bee-js/src/types/debug.ts:76](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/debug.ts#L76) --- ## Interface: LastChequesResponse Defined in: [bee-js/src/types/debug.ts:81](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/debug.ts#L81) ## Properties ### lastcheques > **lastcheques**: [`LastChequesForPeerResponse`](LastChequesForPeerResponse.md)[] Defined in: [bee-js/src/types/debug.ts:82](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/debug.ts#L82) --- ## Interface: NodeAddresses Defined in: [bee-js/src/types/debug.ts:17](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/debug.ts#L17) ## Properties ### ethereum > **ethereum**: [`EthAddress`](../classes/EthAddress.md) Defined in: [bee-js/src/types/debug.ts:20](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/debug.ts#L20) *** ### overlay > **overlay**: [`PeerAddress`](../classes/PeerAddress.md) Defined in: [bee-js/src/types/debug.ts:18](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/debug.ts#L18) *** ### pssPublicKey > **pssPublicKey**: [`PublicKey`](../classes/PublicKey.md) Defined in: [bee-js/src/types/debug.ts:22](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/debug.ts#L22) *** ### publicKey > **publicKey**: [`PublicKey`](../classes/PublicKey.md) Defined in: [bee-js/src/types/debug.ts:21](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/debug.ts#L21) *** ### underlay > **underlay**: `string`[] Defined in: [bee-js/src/types/debug.ts:19](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/debug.ts#L19) --- ## Interface: NodeInfo Defined in: [bee-js/src/types/debug.ts:176](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/debug.ts#L176) Information about Bee node and its configuration ## Properties ### beeMode > **beeMode**: [`BeeModes`](../enumerations/BeeModes.md) Defined in: [bee-js/src/types/debug.ts:180](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/debug.ts#L180) Indicates in what mode Bee is running. *** ### chequebookEnabled > **chequebookEnabled**: `boolean` Defined in: [bee-js/src/types/debug.ts:187](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/debug.ts#L187) Indicates whether the Bee node has its own deployed chequebook. #### See [Bee docs - Chequebook](https://docs.ethswarm.org/docs/references/glossary/#cheques--chequebook) *** ### swapEnabled > **swapEnabled**: `boolean` Defined in: [bee-js/src/types/debug.ts:194](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/debug.ts#L194) Indicates whether SWAP is enabled for the Bee node. #### See [Bee docs - SWAP](https://docs.ethswarm.org/docs/references/glossary/#swap) --- ## Interface: Peer Defined in: [bee-js/src/types/debug.ts:25](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/debug.ts#L25) ## Properties ### address > **address**: `string` Defined in: [bee-js/src/types/debug.ts:26](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/debug.ts#L26) *** ### fullNode? > `optional` **fullNode**: `boolean` Defined in: [bee-js/src/types/debug.ts:27](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/debug.ts#L27) --- ## Interface: PeerBalance Defined in: [bee-js/src/types/debug.ts:85](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/debug.ts#L85) ## Properties ### balance > **balance**: [`BZZ`](../classes/BZZ.md) Defined in: [bee-js/src/types/debug.ts:87](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/debug.ts#L87) *** ### peer > **peer**: `string` Defined in: [bee-js/src/types/debug.ts:86](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/debug.ts#L86) --- ## Interface: Pin Defined in: [bee-js/src/types/index.ts:323](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L323) ## Properties ### reference > **reference**: [`Reference`](../classes/Reference.md) Defined in: [bee-js/src/types/index.ts:324](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L324) --- ## Interface: PingResponse Defined in: [bee-js/src/types/debug.ts:254](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/debug.ts#L254) ## Properties ### rtt > **rtt**: `string` Defined in: [bee-js/src/types/debug.ts:255](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/debug.ts#L255) --- ## Interface: PostageBatch Defined in: [bee-js/src/types/index.ts:525](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L525) ## Properties ### amount > **amount**: [`NumberString`](../type-aliases/NumberString.md) Defined in: [bee-js/src/types/index.ts:539](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L539) *** ### batchID > **batchID**: [`BatchId`](../classes/BatchId.md) Defined in: [bee-js/src/types/index.ts:526](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L526) *** ### blockNumber > **blockNumber**: `number` Defined in: [bee-js/src/types/index.ts:541](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L541) *** ### bucketDepth > **bucketDepth**: `number` Defined in: [bee-js/src/types/index.ts:540](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L540) *** ### depth > **depth**: `number` Defined in: [bee-js/src/types/index.ts:538](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L538) *** ### duration > **duration**: [`Duration`](../classes/Duration.md) Defined in: [bee-js/src/types/index.ts:546](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L546) Estimated time until the batch expires *** ### immutableFlag > **immutableFlag**: `boolean` Defined in: [bee-js/src/types/index.ts:542](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L542) *** ### label > **label**: `string` Defined in: [bee-js/src/types/index.ts:537](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L537) *** ### remainingSize > **remainingSize**: [`Size`](../classes/Size.md) Defined in: [bee-js/src/types/index.ts:562](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L562) Estimated remaining size *** ### size > **size**: [`Size`](../classes/Size.md) Defined in: [bee-js/src/types/index.ts:558](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L558) Effective size *** ### theoreticalSize > **theoreticalSize**: [`Size`](../classes/Size.md) Defined in: [bee-js/src/types/index.ts:566](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L566) Theoretical size in bytes *** ### usable > **usable**: `boolean` Defined in: [bee-js/src/types/index.ts:536](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L536) *** ### usage > **usage**: `number` Defined in: [bee-js/src/types/index.ts:550](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L550) A floating point number from 0 to 1, where 0 is no usage, 1 is full usage. *** ### usageText > **usageText**: `string` Defined in: [bee-js/src/types/index.ts:554](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L554) Human readable usage text, like "50%" or "100%", no fractions *** ### utilization > **utilization**: `number` Defined in: [bee-js/src/types/index.ts:535](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L535) Represents how much of the batch is used up. Max utilization = `2 ** (depth - bucketDepth)` Since the smallest depth is 17, and one batch has 65,536 buckets, and one chunk is 4,096 bytes, the 512MB theoretical max size for the smallest stamp comes from `2 * 65536 * 4096 = 512MB` ## Methods ### calculateRemainingSize() > **calculateRemainingSize**(`encryption`, `redundancyLevel`): [`Size`](../classes/Size.md) Defined in: [bee-js/src/types/index.ts:576](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L576) Calculates the remaining size of data that can be uploaded with this postage batch based on whether encryption is used and the desired redundancy level. #### Parameters ##### encryption `boolean` ##### redundancyLevel [`RedundancyLevel`](../enumerations/RedundancyLevel.md) #### Returns [`Size`](../classes/Size.md) *** ### calculateSize() > **calculateSize**(`encryption`, `redundancyLevel`): [`Size`](../classes/Size.md) Defined in: [bee-js/src/types/index.ts:571](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L571) Calculates the effective size of data that can be uploaded with this postage batch based on whether encryption is used and the desired redundancy level. #### Parameters ##### encryption `boolean` ##### redundancyLevel [`RedundancyLevel`](../enumerations/RedundancyLevel.md) #### Returns [`Size`](../classes/Size.md) --- ## Interface: PostageBatchBuckets Defined in: [bee-js/src/types/index.ts:584](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L584) ## Properties ### bucketDepth > **bucketDepth**: `number` Defined in: [bee-js/src/types/index.ts:586](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L586) *** ### buckets > **buckets**: [`BatchBucket`](BatchBucket.md)[] Defined in: [bee-js/src/types/index.ts:588](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L588) *** ### bucketUpperBound > **bucketUpperBound**: `number` Defined in: [bee-js/src/types/index.ts:587](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L587) *** ### depth > **depth**: `number` Defined in: [bee-js/src/types/index.ts:585](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L585) --- ## Interface: PostageBatchOptions Defined in: [bee-js/src/types/index.ts:606](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L606) Options for creation of postage batch ## Properties ### gasPrice? > `optional` **gasPrice**: `string` \| `bigint` \| [`NumberString`](../type-aliases/NumberString.md) Defined in: [bee-js/src/types/index.ts:615](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L615) Sets gas price in Wei for the transaction that creates the postage batch *** ### immutableFlag? > `optional` **immutableFlag**: `boolean` Defined in: [bee-js/src/types/index.ts:620](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L620) Controls whether data can be overwritten that was uploaded with this postage batch. *** ### label? > `optional` **label**: `string` Defined in: [bee-js/src/types/index.ts:610](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L610) Sets label for the postage batch *** ### waitForUsable? > `optional` **waitForUsable**: `boolean` Defined in: [bee-js/src/types/index.ts:632](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L632) The returned Promise will await until the purchased Postage Batch is usable. In other word, it has to have enough block confirmations that Bee pronounce it usable. When turned on, this significantly prolongs the creation of postage batch! If you plan to use the stamp right away for some action with Bee (like uploading using this stamp) it is highly recommended to use this option, otherwise you might get errors "stamp not usable" from Bee. #### Default ```ts true ``` *** ### waitForUsableTimeout? > `optional` **waitForUsableTimeout**: `number` Defined in: [bee-js/src/types/index.ts:638](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L638) When waiting for the postage stamp to become usable, this specify the timeout for the waiting. Default: 120s --- ## Interface: PssMessageHandler Defined in: [bee-js/src/types/index.ts:375](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L375) ## Properties ### onClose() > **onClose**: (`subscription`) => `void` Defined in: [bee-js/src/types/index.ts:378](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L378) #### Parameters ##### subscription [`PssSubscription`](PssSubscription.md) #### Returns `void` *** ### onError() > **onError**: (`error`, `subscription`) => `void` Defined in: [bee-js/src/types/index.ts:377](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L377) #### Parameters ##### error [`BeeError`](../classes/BeeError.md) ##### subscription [`PssSubscription`](PssSubscription.md) #### Returns `void` *** ### onMessage() > **onMessage**: (`message`, `subscription`) => `void` Defined in: [bee-js/src/types/index.ts:376](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L376) #### Parameters ##### message [`Bytes`](../classes/Bytes.md) ##### subscription [`PssSubscription`](PssSubscription.md) #### Returns `void` --- ## Interface: PssSubscription Defined in: [bee-js/src/types/index.ts:370](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L370) ## Properties ### cancel() > **cancel**: () => `void` Defined in: [bee-js/src/types/index.ts:372](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L372) #### Returns `void` *** ### topic > `readonly` **topic**: [`Topic`](../classes/Topic.md) Defined in: [bee-js/src/types/index.ts:371](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L371) --- ## Interface: Readiness Defined in: [bee-js/src/types/debug.ts:117](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/debug.ts#L117) ## Properties ### apiVersion > **apiVersion**: `string` Defined in: [bee-js/src/types/debug.ts:120](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/debug.ts#L120) *** ### status > **status**: `string` Defined in: [bee-js/src/types/debug.ts:118](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/debug.ts#L118) *** ### version > **version**: `string` Defined in: [bee-js/src/types/debug.ts:119](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/debug.ts#L119) --- ## Interface: RedistributionState Defined in: [bee-js/src/types/debug.ts:152](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/debug.ts#L152) ## Properties ### block > **block**: `number` Defined in: [bee-js/src/types/debug.ts:164](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/debug.ts#L164) *** ### enabled > **enabled**: `boolean` Defined in: [bee-js/src/types/debug.ts:168](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/debug.ts#L168) *** ### fees > **fees**: [`DAI`](../classes/DAI.md) Defined in: [bee-js/src/types/debug.ts:166](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/debug.ts#L166) *** ### hasCommittedThisRound > **hasCommittedThisRound**: `boolean` Defined in: [bee-js/src/types/debug.ts:169](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/debug.ts#L169) *** ### hasRevealedThisRound > **hasRevealedThisRound**: `boolean` Defined in: [bee-js/src/types/debug.ts:170](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/debug.ts#L170) *** ### hasSufficientFunds > **hasSufficientFunds**: `boolean` Defined in: [bee-js/src/types/debug.ts:154](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/debug.ts#L154) *** ### isFrozen > **isFrozen**: `boolean` Defined in: [bee-js/src/types/debug.ts:155](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/debug.ts#L155) *** ### isFullySynced > **isFullySynced**: `boolean` Defined in: [bee-js/src/types/debug.ts:156](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/debug.ts#L156) *** ### isHealthy > **isHealthy**: `boolean` Defined in: [bee-js/src/types/debug.ts:167](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/debug.ts#L167) *** ### lastFrozenRound > **lastFrozenRound**: `number` Defined in: [bee-js/src/types/debug.ts:161](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/debug.ts#L161) *** ### lastPlayedRound > **lastPlayedRound**: `number` Defined in: [bee-js/src/types/debug.ts:160](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/debug.ts#L160) *** ### lastSampleDurationSeconds > **lastSampleDurationSeconds**: `number` Defined in: [bee-js/src/types/debug.ts:163](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/debug.ts#L163) *** ### lastSelectedRound > **lastSelectedRound**: `number` Defined in: [bee-js/src/types/debug.ts:162](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/debug.ts#L162) *** ### lastWonRound > **lastWonRound**: `number` Defined in: [bee-js/src/types/debug.ts:159](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/debug.ts#L159) *** ### minimumGasFunds > **minimumGasFunds**: [`DAI`](../classes/DAI.md) Defined in: [bee-js/src/types/debug.ts:153](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/debug.ts#L153) *** ### phase > **phase**: `string` Defined in: [bee-js/src/types/debug.ts:157](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/debug.ts#L157) *** ### reward > **reward**: [`BZZ`](../classes/BZZ.md) Defined in: [bee-js/src/types/debug.ts:165](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/debug.ts#L165) *** ### round > **round**: `number` Defined in: [bee-js/src/types/debug.ts:158](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/debug.ts#L158) --- ## Interface: RedundantUploadOptions Defined in: [bee-js/src/types/index.ts:192](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L192) ## Extends - [`UploadOptions`](UploadOptions.md) ## Properties ### act? > `optional` **act**: `boolean` Defined in: [bee-js/src/types/index.ts:127](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L127) If set to true, an ACT will be created for the uploaded data. #### Inherited from [`UploadOptions`](UploadOptions.md).[`act`](UploadOptions.md#act) *** ### actHistoryAddress? > `optional` **actHistoryAddress**: `string` \| `Uint8Array`\<`ArrayBufferLike`\> \| [`Reference`](../classes/Reference.md) Defined in: [bee-js/src/types/index.ts:129](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L129) #### Inherited from [`UploadOptions`](UploadOptions.md).[`actHistoryAddress`](UploadOptions.md#acthistoryaddress) *** ### deferred? > `optional` **deferred**: `boolean` Defined in: [bee-js/src/types/index.ts:169](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L169) Determines if the uploaded data should be sent to the network immediately (eq. deferred=false) or in a deferred fashion (eq. deferred=true). With deferred style client uploads all the data to Bee node first and only then Bee node starts push the data to network itself. The progress of this upload can be tracked with tags. With non-deferred style client uploads the data to Bee which immediately starts pushing the data to network. The request is only finished once all the data was pushed through the Bee node to the network. In future there will be move to the non-deferred style and even the support for deferred upload will be removed from Bee itself. #### Default ```ts true ``` #### Inherited from [`UploadOptions`](UploadOptions.md).[`deferred`](UploadOptions.md#deferred) *** ### encrypt? > `optional` **encrypt**: `boolean` Defined in: [bee-js/src/types/index.ts:148](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L148) Will encrypt the uploaded data and return longer hash which also includes the decryption key. #### See - [Bee docs - Store with Encryption](https://docs.ethswarm.org/docs/develop/access-the-swarm/store-with-encryption) - [Bee API reference - `POST /bzz`](https://docs.ethswarm.org/api/#tag/BZZ/paths/~1bzz/post) - Reference #### Inherited from [`UploadOptions`](UploadOptions.md).[`encrypt`](UploadOptions.md#encrypt) *** ### pin? > `optional` **pin**: `boolean` Defined in: [bee-js/src/types/index.ts:139](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L139) Will pin the data locally in the Bee node as well. Locally pinned data is possible to reupload to network if it disappear. #### See - [Bee docs - Pinning](https://docs.ethswarm.org/docs/develop/access-the-swarm/pinning) - [Bee API reference - `POST /bzz`](https://docs.ethswarm.org/api/#tag/BZZ/paths/~1bzz/post) #### Inherited from [`UploadOptions`](UploadOptions.md).[`pin`](UploadOptions.md#pin) *** ### redundancyLevel? > `optional` **redundancyLevel**: [`RedundancyLevel`](../enumerations/RedundancyLevel.md) Defined in: [bee-js/src/types/index.ts:193](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L193) *** ### tag? > `optional` **tag**: `number` Defined in: [bee-js/src/types/index.ts:157](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L157) Tags keep track of syncing the data with network. This option allows attach existing Tag UUID to the uploaded data. #### See - [Bee API reference - `POST /bzz`](https://docs.ethswarm.org/api/#tag/BZZ/paths/~1bzz/post) - [Bee docs - Syncing / Tags](https://docs.ethswarm.org/docs/develop/access-the-swarm/syncing) #### Link Tag #### Inherited from [`UploadOptions`](UploadOptions.md).[`tag`](UploadOptions.md#tag) --- ## Interface: ReferenceInformation Defined in: [bee-js/src/types/index.ts:327](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L327) ## Properties ### contentLength > **contentLength**: `number` Defined in: [bee-js/src/types/index.ts:328](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L328) --- ## Interface: ReferenceResponse Defined in: [bee-js/src/types/index.ts:403](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L403) ## Properties ### reference > **reference**: [`Reference`](../classes/Reference.md) Defined in: [bee-js/src/types/index.ts:404](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L404) --- ## Interface: RemovePeerResponse Defined in: [bee-js/src/types/debug.ts:197](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/debug.ts#L197) ## Properties ### code > **code**: `0` Defined in: [bee-js/src/types/debug.ts:199](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/debug.ts#L199) *** ### message > **message**: `string` Defined in: [bee-js/src/types/debug.ts:198](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/debug.ts#L198) --- ## Interface: ReserveState Defined in: [bee-js/src/types/debug.ts:258](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/debug.ts#L258) ## Properties ### commitment > **commitment**: `number` Defined in: [bee-js/src/types/debug.ts:261](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/debug.ts#L261) *** ### radius > **radius**: `number` Defined in: [bee-js/src/types/debug.ts:259](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/debug.ts#L259) *** ### reserveCapacityDoubling > **reserveCapacityDoubling**: `number` Defined in: [bee-js/src/types/debug.ts:262](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/debug.ts#L262) *** ### storageRadius > **storageRadius**: `number` Defined in: [bee-js/src/types/debug.ts:260](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/debug.ts#L260) --- ## Interface: SOCReader Defined in: [bee-js/src/types/index.ts:485](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L485) Interface for downloading single owner chunks ## Extended by - [`SOCWriter`](SOCWriter.md) ## Properties ### download() > **download**: (`identifier`) => `Promise`\<[`SingleOwnerChunk`](SingleOwnerChunk.md)\> Defined in: [bee-js/src/types/index.ts:492](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L492) Downloads a single owner chunk #### Parameters ##### identifier The identifier of the chunk `string` | `Uint8Array`\<`ArrayBufferLike`\> | [`Identifier`](../classes/Identifier.md) #### Returns `Promise`\<[`SingleOwnerChunk`](SingleOwnerChunk.md)\> *** ### owner > `readonly` **owner**: [`EthAddress`](../classes/EthAddress.md) Defined in: [bee-js/src/types/index.ts:486](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L486) --- ## Interface: SOCWriter Defined in: [bee-js/src/types/index.ts:498](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L498) Interface for downloading and uploading single owner chunks ## Extends - [`SOCReader`](SOCReader.md) ## Properties ### download() > **download**: (`identifier`) => `Promise`\<[`SingleOwnerChunk`](SingleOwnerChunk.md)\> Defined in: [bee-js/src/types/index.ts:492](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L492) Downloads a single owner chunk #### Parameters ##### identifier The identifier of the chunk `string` | `Uint8Array`\<`ArrayBufferLike`\> | [`Identifier`](../classes/Identifier.md) #### Returns `Promise`\<[`SingleOwnerChunk`](SingleOwnerChunk.md)\> #### Inherited from [`SOCReader`](SOCReader.md).[`download`](SOCReader.md#download) *** ### owner > `readonly` **owner**: [`EthAddress`](../classes/EthAddress.md) Defined in: [bee-js/src/types/index.ts:486](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L486) #### Inherited from [`SOCReader`](SOCReader.md).[`owner`](SOCReader.md#owner) *** ### upload() > **upload**: (`stamp`, `identifier`, `data`, `options?`) => `Promise`\<[`UploadResult`](UploadResult.md)\> Defined in: [bee-js/src/types/index.ts:506](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L506) Uploads a single owner chunk #### Parameters ##### stamp `string` | `Uint8Array`\<`ArrayBufferLike`\> | [`BatchId`](../classes/BatchId.md) ##### identifier The identifier of the chunk `string` | `Uint8Array`\<`ArrayBufferLike`\> | [`Identifier`](../classes/Identifier.md) ##### data `Uint8Array` The chunk payload data ##### options? [`ChunkUploadOptions`](ChunkUploadOptions.md) Upload options #### Returns `Promise`\<[`UploadResult`](UploadResult.md)\> --- ## Interface: Settlements Defined in: [bee-js/src/types/debug.ts:5](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/debug.ts#L5) ## Properties ### peer > **peer**: `string` Defined in: [bee-js/src/types/debug.ts:6](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/debug.ts#L6) *** ### received > **received**: [`BZZ`](../classes/BZZ.md) Defined in: [bee-js/src/types/debug.ts:7](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/debug.ts#L7) *** ### sent > **sent**: [`BZZ`](../classes/BZZ.md) Defined in: [bee-js/src/types/debug.ts:8](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/debug.ts#L8) --- ## Interface: SingleOwnerChunk Defined in: [core-sdk/src/chunk/soc.ts:52](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/chunk/soc.ts#L52) Single Owner Chunk (SOC) - a chunk type where the address is determined by the owner and an arbitrary identifier. Its integrity is attested by the owner's digital signature rather than by hashing the content directly. - `span` indicates the size of the `payload` in bytes. - `payload` contains the actual data or the body of the chunk. - `data` contains the full chunk data - `identifier`, `signature`, `span` and `payload`. - `address` is the Swarm hash (or reference) of the chunk. - `identifier` is an arbitrary identifier selected by the uploader. - `signature` is the 65-byte (r || s || v) signature of the owner over the identifier and the wrapped chunk's address. - `owner` is the Ethereum address of the chunk owner. ## Properties ### address > **address**: [`Reference`](../classes/Reference.md) Defined in: [core-sdk/src/chunk/soc.ts:56](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/chunk/soc.ts#L56) *** ### data > `readonly` **data**: `Uint8Array` Defined in: [core-sdk/src/chunk/soc.ts:53](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/chunk/soc.ts#L53) *** ### identifier > **identifier**: [`Identifier`](../classes/Identifier.md) Defined in: [core-sdk/src/chunk/soc.ts:57](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/chunk/soc.ts#L57) *** ### owner > **owner**: [`EthAddress`](../classes/EthAddress.md) Defined in: [core-sdk/src/chunk/soc.ts:59](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/chunk/soc.ts#L59) *** ### payload > **payload**: [`Bytes`](../classes/Bytes.md) Defined in: [core-sdk/src/chunk/soc.ts:55](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/chunk/soc.ts#L55) *** ### signature > **signature**: [`Signature`](../classes/Signature.md) Defined in: [core-sdk/src/chunk/soc.ts:58](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/chunk/soc.ts#L58) *** ### span > **span**: [`Span`](../classes/Span.md) Defined in: [core-sdk/src/chunk/soc.ts:54](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/chunk/soc.ts#L54) --- ## Interface: Tag Defined in: [bee-js/src/types/index.ts:297](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L297) Object that contains information about upload progress of data to network. The total amount of chunks is represented by `split` property. The actual progress of the upload can be tracked by the `seen + synced` properties. ## See [Bee docs - Syncing / Tags](https://docs.ethswarm.org/docs/develop/access-the-swarm/syncing) ## Properties ### address > **address**: `string` Defined in: [bee-js/src/types/index.ts:304](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L304) *** ### seen > **seen**: `number` Defined in: [bee-js/src/types/index.ts:299](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L299) *** ### sent > **sent**: `number` Defined in: [bee-js/src/types/index.ts:301](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L301) *** ### split > **split**: `number` Defined in: [bee-js/src/types/index.ts:298](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L298) *** ### startedAt > **startedAt**: `string` Defined in: [bee-js/src/types/index.ts:305](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L305) *** ### stored > **stored**: `number` Defined in: [bee-js/src/types/index.ts:300](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L300) *** ### synced > **synced**: `number` Defined in: [bee-js/src/types/index.ts:302](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L302) *** ### uid > **uid**: `number` Defined in: [bee-js/src/types/index.ts:303](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L303) --- ## Interface: Topology Defined in: [bee-js/src/types/debug.ts:209](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/debug.ts#L209) ## Properties ### baseAddr > **baseAddr**: `string` Defined in: [bee-js/src/types/debug.ts:210](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/debug.ts#L210) *** ### bins > **bins**: `object` Defined in: [bee-js/src/types/debug.ts:218](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/debug.ts#L218) #### bin\_0 > **bin\_0**: [`Bin`](Bin.md) #### bin\_1 > **bin\_1**: [`Bin`](Bin.md) #### bin\_10 > **bin\_10**: [`Bin`](Bin.md) #### bin\_11 > **bin\_11**: [`Bin`](Bin.md) #### bin\_12 > **bin\_12**: [`Bin`](Bin.md) #### bin\_13 > **bin\_13**: [`Bin`](Bin.md) #### bin\_14 > **bin\_14**: [`Bin`](Bin.md) #### bin\_15 > **bin\_15**: [`Bin`](Bin.md) #### bin\_16 > **bin\_16**: [`Bin`](Bin.md) #### bin\_17 > **bin\_17**: [`Bin`](Bin.md) #### bin\_18 > **bin\_18**: [`Bin`](Bin.md) #### bin\_19 > **bin\_19**: [`Bin`](Bin.md) #### bin\_2 > **bin\_2**: [`Bin`](Bin.md) #### bin\_20 > **bin\_20**: [`Bin`](Bin.md) #### bin\_21 > **bin\_21**: [`Bin`](Bin.md) #### bin\_22 > **bin\_22**: [`Bin`](Bin.md) #### bin\_23 > **bin\_23**: [`Bin`](Bin.md) #### bin\_24 > **bin\_24**: [`Bin`](Bin.md) #### bin\_25 > **bin\_25**: [`Bin`](Bin.md) #### bin\_26 > **bin\_26**: [`Bin`](Bin.md) #### bin\_27 > **bin\_27**: [`Bin`](Bin.md) #### bin\_28 > **bin\_28**: [`Bin`](Bin.md) #### bin\_29 > **bin\_29**: [`Bin`](Bin.md) #### bin\_3 > **bin\_3**: [`Bin`](Bin.md) #### bin\_30 > **bin\_30**: [`Bin`](Bin.md) #### bin\_31 > **bin\_31**: [`Bin`](Bin.md) #### bin\_4 > **bin\_4**: [`Bin`](Bin.md) #### bin\_5 > **bin\_5**: [`Bin`](Bin.md) #### bin\_6 > **bin\_6**: [`Bin`](Bin.md) #### bin\_7 > **bin\_7**: [`Bin`](Bin.md) #### bin\_8 > **bin\_8**: [`Bin`](Bin.md) #### bin\_9 > **bin\_9**: [`Bin`](Bin.md) *** ### connected > **connected**: `number` Defined in: [bee-js/src/types/debug.ts:212](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/debug.ts#L212) *** ### depth > **depth**: `number` Defined in: [bee-js/src/types/debug.ts:215](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/debug.ts#L215) *** ### networkAvailability > **networkAvailability**: `string` Defined in: [bee-js/src/types/debug.ts:217](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/debug.ts#L217) *** ### nnLowWatermark > **nnLowWatermark**: `number` Defined in: [bee-js/src/types/debug.ts:214](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/debug.ts#L214) *** ### population > **population**: `number` Defined in: [bee-js/src/types/debug.ts:211](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/debug.ts#L211) *** ### reachability > **reachability**: `string` Defined in: [bee-js/src/types/debug.ts:216](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/debug.ts#L216) *** ### timestamp > **timestamp**: `string` Defined in: [bee-js/src/types/debug.ts:213](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/debug.ts#L213) --- ## Interface: TransactionInfo Defined in: [bee-js/src/types/index.ts:591](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L591) ## Properties ### created > **created**: `string` Defined in: [bee-js/src/types/index.ts:598](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L598) *** ### data > **data**: `string` Defined in: [bee-js/src/types/index.ts:597](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L597) *** ### description > **description**: `string` Defined in: [bee-js/src/types/index.ts:599](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L599) *** ### gasLimit > **gasLimit**: `number` Defined in: [bee-js/src/types/index.ts:596](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L596) *** ### gasPrice > **gasPrice**: [`NumberString`](../type-aliases/NumberString.md) Defined in: [bee-js/src/types/index.ts:595](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L595) *** ### nonce > **nonce**: `number` Defined in: [bee-js/src/types/index.ts:594](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L594) *** ### to > **to**: `string` Defined in: [bee-js/src/types/index.ts:593](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L593) *** ### transactionHash > **transactionHash**: [`TransactionId`](../classes/TransactionId.md) Defined in: [bee-js/src/types/index.ts:592](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L592) *** ### value > **value**: `string` Defined in: [bee-js/src/types/index.ts:600](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L600) --- ## Interface: TransactionOptions Defined in: [bee-js/src/types/debug.ts:39](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/debug.ts#L39) ## Properties ### gasLimit? > `optional` **gasLimit**: `string` \| `bigint` \| [`NumberString`](../type-aliases/NumberString.md) Defined in: [bee-js/src/types/debug.ts:48](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/debug.ts#L48) Gas limit for the cashout transaction in WEI *** ### gasPrice? > `optional` **gasPrice**: `string` \| `bigint` \| [`NumberString`](../type-aliases/NumberString.md) Defined in: [bee-js/src/types/debug.ts:43](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/debug.ts#L43) Gas price for the cashout transaction in WEI --- ## Interface: TransactionResponse Defined in: [bee-js/src/types/debug.ts:65](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/debug.ts#L65) ## Properties ### transactionHash > **transactionHash**: [`TransactionId`](../classes/TransactionId.md) Defined in: [bee-js/src/types/debug.ts:66](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/debug.ts#L66) --- ## Interface: UploadHeaders Defined in: [bee-js/src/types/index.ts:280](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L280) ## Properties ### swarm-act? > `optional` **swarm-act**: `string` Defined in: [bee-js/src/types/index.ts:281](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L281) *** ### swarm-encrypt? > `optional` **swarm-encrypt**: `string` Defined in: [bee-js/src/types/index.ts:283](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L283) *** ### swarm-pin? > `optional` **swarm-pin**: `string` Defined in: [bee-js/src/types/index.ts:282](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L282) *** ### swarm-postage-batch-id? > `optional` **swarm-postage-batch-id**: `string` Defined in: [bee-js/src/types/index.ts:285](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L285) *** ### swarm-tag? > `optional` **swarm-tag**: `string` Defined in: [bee-js/src/types/index.ts:284](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L284) --- ## Interface: UploadOptions Defined in: [bee-js/src/types/index.ts:123](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L123) ## Extended by - [`RedundantUploadOptions`](RedundantUploadOptions.md) - [`FileUploadOptions`](FileUploadOptions.md) - [`CollectionUploadOptions`](CollectionUploadOptions.md) ## Properties ### act? > `optional` **act**: `boolean` Defined in: [bee-js/src/types/index.ts:127](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L127) If set to true, an ACT will be created for the uploaded data. *** ### actHistoryAddress? > `optional` **actHistoryAddress**: `string` \| `Uint8Array`\<`ArrayBufferLike`\> \| [`Reference`](../classes/Reference.md) Defined in: [bee-js/src/types/index.ts:129](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L129) *** ### deferred? > `optional` **deferred**: `boolean` Defined in: [bee-js/src/types/index.ts:169](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L169) Determines if the uploaded data should be sent to the network immediately (eq. deferred=false) or in a deferred fashion (eq. deferred=true). With deferred style client uploads all the data to Bee node first and only then Bee node starts push the data to network itself. The progress of this upload can be tracked with tags. With non-deferred style client uploads the data to Bee which immediately starts pushing the data to network. The request is only finished once all the data was pushed through the Bee node to the network. In future there will be move to the non-deferred style and even the support for deferred upload will be removed from Bee itself. #### Default ```ts true ``` *** ### encrypt? > `optional` **encrypt**: `boolean` Defined in: [bee-js/src/types/index.ts:148](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L148) Will encrypt the uploaded data and return longer hash which also includes the decryption key. #### See - [Bee docs - Store with Encryption](https://docs.ethswarm.org/docs/develop/access-the-swarm/store-with-encryption) - [Bee API reference - `POST /bzz`](https://docs.ethswarm.org/api/#tag/BZZ/paths/~1bzz/post) - Reference *** ### pin? > `optional` **pin**: `boolean` Defined in: [bee-js/src/types/index.ts:139](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L139) Will pin the data locally in the Bee node as well. Locally pinned data is possible to reupload to network if it disappear. #### See - [Bee docs - Pinning](https://docs.ethswarm.org/docs/develop/access-the-swarm/pinning) - [Bee API reference - `POST /bzz`](https://docs.ethswarm.org/api/#tag/BZZ/paths/~1bzz/post) *** ### tag? > `optional` **tag**: `number` Defined in: [bee-js/src/types/index.ts:157](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L157) Tags keep track of syncing the data with network. This option allows attach existing Tag UUID to the uploaded data. #### See - [Bee API reference - `POST /bzz`](https://docs.ethswarm.org/api/#tag/BZZ/paths/~1bzz/post) - [Bee docs - Syncing / Tags](https://docs.ethswarm.org/docs/develop/access-the-swarm/syncing) #### Link Tag --- ## Interface: UploadProgress Defined in: [bee-js/src/utils/upload-progress.ts:1](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/utils/upload-progress.ts#L1) ## Properties ### processed > **processed**: `number` Defined in: [bee-js/src/utils/upload-progress.ts:3](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/utils/upload-progress.ts#L3) *** ### total > **total**: `number` Defined in: [bee-js/src/utils/upload-progress.ts:2](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/utils/upload-progress.ts#L2) --- ## Interface: UploadResult Defined in: [bee-js/src/types/index.ts:106](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L106) Result of upload calls. ## Properties ### historyAddress > **historyAddress**: `Optional`\<[`Reference`](../classes/Reference.md)\> Defined in: [bee-js/src/types/index.ts:120](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L120) History address of the uploaded data with ACT. *** ### reference > **reference**: [`Reference`](../classes/Reference.md) Defined in: [bee-js/src/types/index.ts:110](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L110) Reference of the uploaded data *** ### tagUid? > `optional` **tagUid**: `number` Defined in: [bee-js/src/types/index.ts:115](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L115) Automatically created tag's UID. --- ## Interface: WalletBalance Defined in: [bee-js/src/types/debug.ts:273](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/debug.ts#L273) ## Properties ### bzzBalance > **bzzBalance**: [`BZZ`](../classes/BZZ.md) Defined in: [bee-js/src/types/debug.ts:274](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/debug.ts#L274) *** ### chainID > **chainID**: `number` Defined in: [bee-js/src/types/debug.ts:276](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/debug.ts#L276) *** ### chequebookContractAddress > **chequebookContractAddress**: `string` Defined in: [bee-js/src/types/debug.ts:277](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/debug.ts#L277) *** ### nativeTokenBalance > **nativeTokenBalance**: [`DAI`](../classes/DAI.md) Defined in: [bee-js/src/types/debug.ts:275](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/debug.ts#L275) *** ### walletAddress > **walletAddress**: `string` Defined in: [bee-js/src/types/debug.ts:278](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/debug.ts#L278) --- ## Function: approximateOverheadForRedundancyLevel() > **approximateOverheadForRedundancyLevel**(`chunks`, `level`, `encrypted`): `number` Defined in: [core-sdk/src/erasure-coding/levels.ts:95](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/erasure-coding/levels.ts#L95) Returns an approximate multiplier for the storage overhead of uploading `chunks` data shards at the given redundancy level: use it to estimate how many extra chunks will be stored (chunks * overhead) for that upload. Computed directly from getParities' exact tables above rather than a separate estimation table - bee-js's own redundancy.ts had a second, independent set of tables for this that turned out to be a rougher approximation of the same data (one threshold short per level), not a genuinely different computation. ## Parameters ### chunks `number` ### level `number` ### encrypted `boolean` ## Returns `number` --- ## Function: convertEnvelopeToMarshaledStamp() > **convertEnvelopeToMarshaledStamp**(`envelope`): [`Bytes`](../../classes/Bytes.md) Defined in: [bee-js/src/utils/stamps.ts:66](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/utils/stamps.ts#L66) ## Parameters ### envelope [`EnvelopeWithBatchId`](../../interfaces/EnvelopeWithBatchId.md) ## Returns [`Bytes`](../../classes/Bytes.md) --- ## Function: getAmountForDuration() > **getAmountForDuration**(`duration`, `pricePerBlock`, `blockTime`): `bigint` Defined in: [bee-js/src/utils/stamps.ts:52](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/utils/stamps.ts#L52) Get the postage batch `amount` required for a given `duration`. ## Parameters ### duration [`Duration`](../../classes/Duration.md) A duration object representing the duration of the storage. ### pricePerBlock `number` The price per block in PLUR. ### blockTime `number` The block time in seconds. ## Returns `bigint` --- ## Function: getCollectionSize() > **getCollectionSize**(`fileList`): `number` Defined in: [bee-js/src/utils/collection.ts:44](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/utils/collection.ts#L44) Calculate cumulative size of files ## Parameters ### fileList list of files to check `File`[] | `FileList` ## Returns `number` size in bytes --- ## Function: getDepthForSize() > **getDepthForSize**(`size`, `encryption?`, `erasureCodeLevel?`): `number` Defined in: [bee-js/src/utils/stamps.ts:62](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/utils/stamps.ts#L62) Utility function that calculates the depth required for a postage batch to achieve the specified effective size ## Parameters ### size [`Size`](../../classes/Size.md) The effective size of the postage batch ### encryption? `boolean` ### erasureCodeLevel? [`RedundancyLevel`](../../enumerations/RedundancyLevel.md) ## Returns `number` --- ## Function: getFolderSize() > **getFolderSize**(`dir`): `Promise`\<`number`\> Defined in: [bee-js/src/utils/collection.node.ts:51](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/utils/collection.node.ts#L51) Calculate folder size recursively ## Parameters ### dir `string` the path to the folder to check ## Returns `Promise`\<`number`\> size in bytes --- ## Function: getRedundancyStat() > **getRedundancyStat**(`level`): `RedundancyStat` Defined in: [core-sdk/src/erasure-coding/levels.ts:132](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/erasure-coding/levels.ts#L132) Looks up a single redundancy level's stats by name ('medium'/'strong'/ 'insane'/'paranoid', case-insensitive) or by its numeric level (1-4). ## Parameters ### level `string` | `number` ## Returns `RedundancyStat` --- ## Function: getRedundancyStats() > **getRedundancyStats**(): `object` Defined in: [core-sdk/src/erasure-coding/levels.ts:119](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/erasure-coding/levels.ts#L119) Returns descriptive stats (label, level, expected error tolerance) for every redundancy level above NONE. ## Returns `object` ### insane > **insane**: `RedundancyStat` ### medium > **medium**: `RedundancyStat` ### paranoid > **paranoid**: `RedundancyStat` ### strong > **strong**: `RedundancyStat` --- ## Function: getStampCost() > **getStampCost**(`depth`, `amount`): [`BZZ`](../../classes/BZZ.md) Defined in: [bee-js/src/utils/stamps.ts:24](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/utils/stamps.ts#L24) Utility function that calculates the cost of a postage batch based on its depth and amount. ## Parameters ### depth `number` ### amount `string` | `bigint` | [`NumberString`](../../type-aliases/NumberString.md) ## Returns [`BZZ`](../../classes/BZZ.md) --- ## Function: getStampDuration() > **getStampDuration**(`amount`, `pricePerBlock`, `blockTime`): [`Duration`](../../classes/Duration.md) Defined in: [bee-js/src/utils/stamps.ts:35](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/utils/stamps.ts#L35) Utility function that calculates the TTL of a postage batch based on its amount, price per block and block time. For more accurate results, get the price per block and block time from the Bee node or the blockchain. ## Parameters ### amount `string` | `bigint` | [`NumberString`](../../type-aliases/NumberString.md) ### pricePerBlock `number` ### blockTime `number` ## Returns [`Duration`](../../classes/Duration.md) The TTL of the postage batch. --- ## Function: getStampEffectiveBytes() > **getStampEffectiveBytes**(`depth`, `encryption?`, `erasureCodeLevel?`): `number` Defined in: [core-sdk/src/stamper/capacity.ts:352](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/stamper/capacity.ts#L352) Calculates the effective size of a postage batch based on its depth. Below depth 17 the effective size is 0. When `encryption` and `erasureCodeLevel` (0=NONE, 1=MEDIUM, 2=STRONG, 3=INSANE, 4=PARANOID) are both given, uses the exact breakpoint table for that combination; otherwise falls back to the encrypted+MEDIUM-optimised default table. ## Parameters ### depth `number` ### encryption? `boolean` ### erasureCodeLevel? `number` ## Returns `number` The effective size of the postage batch, in bytes. --- ## Function: getStampEffectiveBytesBreakpoints() > **getStampEffectiveBytesBreakpoints**(`encryption`, `erasureCodeLevel?`): `Map`\<`number`, `number`\> Defined in: [core-sdk/src/stamper/capacity.ts:379](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/stamper/capacity.ts#L379) Returns the effective size (in bytes) for every depth in the supported breakpoint range (17..34), keyed by depth. ## Parameters ### encryption `boolean` ### erasureCodeLevel? `number` ## Returns `Map`\<`number`, `number`\> --- ## Function: getStampTheoreticalBytes() > **getStampTheoreticalBytes**(`depth`): `number` Defined in: [core-sdk/src/stamper/capacity.ts:17](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/stamper/capacity.ts#L17) Calculates the theoretical maximum size of a postage batch based on its depth. For smaller depths (up to 22), this may provide less accurate results. ## Parameters ### depth `number` ## Returns `number` The maximum theoretical size of the postage batch, in bytes. --- ## Function: getStampUsage() > **getStampUsage**(`utilization`, `depth`, `bucketDepth`): `number` Defined in: [core-sdk/src/stamper/capacity.ts:7](https://github.com/ethersphere/core-sdk/blob/599be256a6dfdd96418988f234bbe147146fe59b/src/stamper/capacity.ts#L7) Calculates usage of a postage batch based on its utilization, depth, and bucket depth. For smaller depths (up to 20), this may provide less accurate results. ## Parameters ### utilization `number` ### depth `number` ### bucketDepth `number` ## Returns `number` A number between 0 and 1 representing the usage of the postage batch. --- ## Function: makeCollectionFromFileList() > **makeCollectionFromFileList**(`fileList`): [`Collection`](../../type-aliases/Collection.md) Defined in: [bee-js/src/utils/collection.ts:30](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/utils/collection.ts#L30) ## Parameters ### fileList `File`[] | `FileList` ## Returns [`Collection`](../../type-aliases/Collection.md) --- ## Function: makeMaxTarget() > **makeMaxTarget**(`target`): `string` Defined in: [bee-js/src/utils/pss.ts:11](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/utils/pss.ts#L11) Utility function that for given strings/reference takes the most specific target that Bee node will except. ## Parameters ### target is a non-prefixed hex string Bee address `string` | `Uint8Array`\<`ArrayBufferLike`\> | [`PeerAddress`](../../classes/PeerAddress.md) ## Returns `string` ## See [Bee docs - PSS](https://docs.ethswarm.org/docs/develop/tools-and-features/pss) --- ## Function: mapPostageBatch() > **mapPostageBatch**(`raw`, `encryption?`, `erasureCodeLevel?`): [`PostageBatch`](../../interfaces/PostageBatch.md) Defined in: [bee-js/src/utils/stamps.ts:93](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/utils/stamps.ts#L93) ## Parameters ### raw `RawPostageBatch` ### encryption? `boolean` ### erasureCodeLevel? [`RedundancyLevel`](../../enumerations/RedundancyLevel.md) ## Returns [`PostageBatch`](../../interfaces/PostageBatch.md) --- ## Function: unmapPostageBatch() > **unmapPostageBatch**(`batch`): `RawPostageBatch` Defined in: [bee-js/src/utils/stamps.ts:132](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/utils/stamps.ts#L132) ## Parameters ### batch [`PostageBatch`](../../interfaces/PostageBatch.md) ## Returns `RawPostageBatch` --- ## Type Alias: BeeRequestOptions > **BeeRequestOptions** = `object` Defined in: [bee-js/src/types/index.ts:51](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L51) Behavior of the HTTP client, such as `timeout`, additional `headers`, custom `httpAgent`, etc. ## Extended by - [`BeeOptions`](../interfaces/BeeOptions.md) ## Properties ### baseURL? > `optional` **baseURL**: `string` Defined in: [bee-js/src/types/index.ts:52](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L52) *** ### endlesslyRetry? > `optional` **endlesslyRetry**: `boolean` Defined in: [bee-js/src/types/index.ts:58](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L58) *** ### headers? > `optional` **headers**: `Record`\<`string`, `string`\> Defined in: [bee-js/src/types/index.ts:54](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L54) *** ### httpAgent? > `optional` **httpAgent**: `unknown` Defined in: [bee-js/src/types/index.ts:56](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L56) *** ### httpsAgent? > `optional` **httpsAgent**: `unknown` Defined in: [bee-js/src/types/index.ts:57](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L57) *** ### onRequest()? > `optional` **onRequest**: (`request`) => `void` Defined in: [bee-js/src/types/index.ts:55](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L55) #### Parameters ##### request [`BeeRequest`](../interfaces/BeeRequest.md) #### Returns `void` *** ### signal? > `optional` **signal**: `AbortSignal` Defined in: [bee-js/src/types/index.ts:59](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L59) *** ### timeout? > `optional` **timeout**: `number` Defined in: [bee-js/src/types/index.ts:53](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L53) --- ## Type Alias: Collection > **Collection** = [`CollectionEntry`](../interfaces/CollectionEntry.md)[] Defined in: [bee-js/src/types/index.ts:368](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L368) Represents Collections --- ## Type Alias: GsocField > **GsocField** = `"address"` \| `"recoveredPubKey"` \| `"identifier"` \| `"signature"` \| `"wrappedAddress"` \| `"span"` \| `"payload"` Defined in: [bee-js/src/types/index.ts:392](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L392) --- ## Type Alias: HookCallback() # Type Alias: HookCallback()\ > **HookCallback**\<`V`\> = (`value`) => `void` \| `Promise`\<`void`\> Defined in: [bee-js/src/types/index.ts:409](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L409) ## Type Parameters ### V `V` ## Parameters ### value `V` ## Returns `void` \| `Promise`\<`void`\> --- ## Type Alias: HttpMethod > **HttpMethod** = `"GET"` \| `"DELETE"` \| `"POST"` \| `"PATCH"` \| `"PUT"` Defined in: [bee-js/src/types/index.ts:407](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L407) --- ## Type Alias: NumberString > **NumberString** = `string` & `object` Defined in: [bee-js/src/types/index.ts:646](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L646) With this type a number should be represented in a string ## Type Declaration ### \_\_numberString > **\_\_numberString**: `never` --- ## Variable: BRANCHES > `const` **BRANCHES**: `128` = `128` Defined in: [bee-js/src/types/index.ts:23](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L23) --- ## Variable: CHUNK_SIZE # Variable: CHUNK\_SIZE > `const` **CHUNK\_SIZE**: `number` Defined in: [bee-js/src/types/index.ts:24](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L24) --- ## Variable: NULL_ADDRESS # Variable: NULL\_ADDRESS > `const` **NULL\_ADDRESS**: `Uint8Array`\<`ArrayBuffer`\> Defined in: [bee-js/src/utils/constants.ts:6](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/utils/constants.ts#L6) --- ## Variable: NULL_IDENTIFIER # Variable: NULL\_IDENTIFIER > `const` **NULL\_IDENTIFIER**: `Uint8Array`\<`ArrayBuffer`\> Defined in: [bee-js/src/utils/constants.ts:7](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/utils/constants.ts#L7) --- ## Variable: NULL_OWNER # Variable: NULL\_OWNER > `const` **NULL\_OWNER**: `Uint8Array`\<`ArrayBuffer`\> Defined in: [bee-js/src/utils/constants.ts:8](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/utils/constants.ts#L8) --- ## Variable: NULL_STAMP # Variable: NULL\_STAMP > `const` **NULL\_STAMP**: [`BatchId`](../classes/BatchId.md) Defined in: [bee-js/src/utils/constants.ts:4](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/utils/constants.ts#L4) --- ## Variable: NULL_TOPIC # Variable: NULL\_TOPIC > `const` **NULL\_TOPIC**: [`Topic`](../classes/Topic.md) Defined in: [bee-js/src/utils/constants.ts:5](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/utils/constants.ts#L5) --- ## Variable: PSS_TARGET_HEX_LENGTH_MAX # Variable: PSS\_TARGET\_HEX\_LENGTH\_MAX > `const` **PSS\_TARGET\_HEX\_LENGTH\_MAX**: `4` = `4` Defined in: [bee-js/src/types/index.ts:26](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L26) --- ## Variable: SECTION_SIZE # Variable: SECTION\_SIZE > `const` **SECTION\_SIZE**: `32` = `32` Defined in: [bee-js/src/types/index.ts:22](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L22) --- ## Variable: STAMPS_DEPTH_MAX # Variable: STAMPS\_DEPTH\_MAX > `const` **STAMPS\_DEPTH\_MAX**: `255` = `255` Defined in: [bee-js/src/types/index.ts:36](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L36) Maximum postage batch depth. --- ## Variable: STAMPS_DEPTH_MIN # Variable: STAMPS\_DEPTH\_MIN > `const` **STAMPS\_DEPTH\_MIN**: `17` = `17` Defined in: [bee-js/src/types/index.ts:31](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L31) Minimum postage batch depth. --- ## Variable: SUPPORTED_BEE_VERSION # Variable: SUPPORTED\_BEE\_VERSION > `const` **SUPPORTED\_BEE\_VERSION**: `string` Defined in: [bee-js/src/version.ts:8](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/version.ts#L8) Supported Bee version without the commit hash suffix. --- ## Variable: SUPPORTED_BEE_VERSION_EXACT # Variable: SUPPORTED\_BEE\_VERSION\_EXACT > `const` **SUPPORTED\_BEE\_VERSION\_EXACT**: `"2.8.3"` = `'2.8.3'` Defined in: [bee-js/src/version.ts:5](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/version.ts#L5) Exact supported Bee version, including the commit hash suffix. --- ## Variable: SWARM_GATEWAY_URL # Variable: SWARM\_GATEWAY\_URL > `const` **SWARM\_GATEWAY\_URL**: `"https://api.gateway.ethswarm.org"` = `'https://api.gateway.ethswarm.org'` Defined in: [bee-js/src/utils/constants.ts:3](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/utils/constants.ts#L3) --- ## Variable: TAGS_LIMIT_MAX # Variable: TAGS\_LIMIT\_MAX > `const` **TAGS\_LIMIT\_MAX**: `1000` = `1000` Defined in: [bee-js/src/types/index.ts:46](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L46) Maximum tags API page size. --- ## Variable: TAGS_LIMIT_MIN # Variable: TAGS\_LIMIT\_MIN > `const` **TAGS\_LIMIT\_MIN**: `1` = `1` Defined in: [bee-js/src/types/index.ts:41](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L41) Minimum tags API page size. --- ## Variable: capacityBreakpoints > `const` **capacityBreakpoints**: `object` Defined in: [bee-js/src/types/index.ts:648](https://github.com/ethersphere/bee-js/blob/549318851eb60f91ad249acad8431ffc2cf86773/src/types/index.ts#L648) ## Type Declaration ### ENCRYPTION\_OFF > **ENCRYPTION\_OFF**: `object` #### ENCRYPTION\_OFF.0 > **0**: `object`[] #### ENCRYPTION\_OFF.1 > **1**: `object`[] #### ENCRYPTION\_OFF.2 > **2**: `object`[] #### ENCRYPTION\_OFF.3 > **3**: `object`[] #### ENCRYPTION\_OFF.4 > **4**: `object`[] ### ENCRYPTION\_ON > **ENCRYPTION\_ON**: `object` #### ENCRYPTION\_ON.0 > **0**: `object`[] #### ENCRYPTION\_ON.1 > **1**: `object`[] #### ENCRYPTION\_ON.2 > **2**: `object`[] #### ENCRYPTION\_ON.3 > **3**: `object`[] #### ENCRYPTION\_ON.4 > **4**: `object`[] --- ## ACT (Access Control Trie) ACT, or Access Control Trie, is a decentralized permission system built into the Swarm network that allows you to restrict access to uploaded content. When you upload data to Swarm using ACT, only the original uploader and users with public keys listed in an associated grantee list are able to retrieve and decrypt that data. The grantee list is published separately and cryptographically referenced during upload and download operations. ACT is ideal for use cases such as the serialized release of content like a podcast or newsletter, where the publisher wishes to limit access to subscribers only. :::warning Once a file is uploaded with ACT, any node whose public key is on the ACT grantees list referenced during the upload ***will have permanent access to that file*** as long as the file reference and history reference returned from the upload have been shared with them. Updating the grantees list to remove a public key ***will not revoke access*** to the content retroactively. Likewise, re-uploading the content using the new grantees list will also ***not retroactively revoke access*** to the content. ::: ## Requirements The use of ACT requires the following: * A Bee light node running with synced postage batch data. (Running at `http://localhost:1633` by default) * A valid postage batch ID. [Buy one](./buying-storage.md#purchasing-storage) if needed. * Public keys of the nodes you want to grant access to. * The **public key of the publishing node**. This can be obtained using the [`bee.connectivity.getNodeAddresses()` method](./status.md#3-get-node-addresses). ## Create Grantees List First we create a grantees list with the public keys of anyone we want to grant access to. #### Example Script: The example script below performs the following key operations: 1. Initializes a Bee client. 2. Defines a list of grantee public keys. 3. Specifies a valid postage batch ID. 4. Calls `bee.grantee.create()` to create a new grantee list. 5. Logs the resulting `ref` and `historyref`. ```js // Initialize Bee instance const bee = new Bee('http://localhost:1633'); // Grantee's public key (replace with the actual key(s) of the node(s) you wish to grant access to) const grantees = [ new PublicKey('027d0c4759f689ea3dd3eb79222870671c492cb99f3fade275bcbf0ea39cd0ef6e'), ]; // Your postage batch ID (replace with your own valid postage batch ID) const postageBatchId = new BatchId('0258a225fe8da54cc6537eb8b12fcf6706c7873dbe19b9381d31729aa0405398'); async function createGranteeList() { try { // Create the grantee list using `bee.grantee.create()` method const response = await bee.grantee.create(postageBatchId, grantees); // Log the response (ref and history ref) console.log('Grantee List Created Successfully:'); console.log('Reference:', response.ref.toHex()); console.log('History Reference:', response.historyref.toHex()); } catch (error) { console.error('Error creating grantee list:', error); } } // Call the function to create the grantee list createGranteeList(); ``` Example output: ```bash Grantee List Created Successfully: Reference: 69da034fdae049eed9a22ec48b98a08ed5d363d48076f88c44ffe3367a18e306cae6aaf1cfce72d59262b9fb9293e15469c01c6a2626bb62478116cc98fb303b History Reference: 18d6f58a1d3c8253a5fc47023d49e9011236ead43724e595e898e1b422b77b19 ``` The first 64 byte (128 hex digit) reference `Grantee List Reference` (`ref`) is used on its own for reviewing the list contents and updating the list. The second reference 32 byte (64 hex digit) `History Reference` (`historyref`) is used for uploading with ACT and is also used along with the first `ref` for creating a new updated grantee list based on the original list referred to by the `ref`. ## Update Grantees List :::info Although we refer to this operation as an "update", due to Swarm's immutable nature, the original list is not modified by this operation. Rather, a new list is created with the specified grantee keys added to or removed from the original list. This operation ***DOES NOT*** retroactively add or remove access to content uploaded with the original ACT list. ::: To update a grantees list, call the `bee.grantee.patch()` method with the following arguments: * A valid postage batch ID * The original list’s `ref` and `historyref` * An object specifying public keys to `add` or `revoke` ```js bee.grantee.patch(postageBatchId, ref, historyref, { add: [grantee1, grantee2], revoke: [], }); ``` Calling this method returns the new list’s updated `ref` and `historyref`, which you should use for future updates or access. #### Example Script: The example script below performs the following key steps: 1. Initializes the Bee client and defines two public keys to add as grantees. 2. Provides the existing grantee list’s `ref` and `historyref`, and a valid postage batch ID. 3. Calls `bee.grantee.patch()` to add the new keys to the list. 4. Logs the updated grantee list’s `ref` and `historyref`. ```js // Initialize Bee instance const bee = new Bee('http://localhost:1633'); // Grantee's public key(s) to be added (replace with the actual key) const grantee1 = new PublicKey('027d0c4759f689ea3dd3eb79222870671c492cb99f3fade275bcbf0ea39cd0ef6e'); const grantee2 = new PublicKey('03636056d1e08f100c5acaf14d10070102de9444c97b2e8215305ab3e97254ede6'); // Grantee list reference and history reference returned from initial list creation const granteeListRef = new Reference('69da034fdae049eed9a22ec48b98a08ed5d363d48076f88c44ffe3367a18e306cae6aaf1cfce72d59262b9fb9293e15469c01c6a2626bb62478116cc98fb303b') const granteeHistoryRef = new Reference('18d6f58a1d3c8253a5fc47023d49e9011236ead43724e595e898e1b422b77b19') // Your postage batch ID (replace with a valid one) const postageBatchId = new BatchId('0258a225fe8da54cc6537eb8b12fcf6706c7873dbe19b9381d31729aa0405398'); // Function to update the grantee list by adding the new public key async function updateGranteeList() { try { // Call bee.grantee.patch() to add the new public keys const response = await bee.grantee.patch(postageBatchId, granteeListRef, granteeHistoryRef, { add: [grantee1, grantee2], // Add the new grantee revoke: [], }); // Log the updated grantee list references console.log('Grantee List Updated Successfully:'); console.log('Updated Reference:', response.ref.toHex()); console.log('Updated History Reference:', response.historyref.toHex()); } catch (error) { console.error('Error updating grantee list:', error.message); if (error.response) { // If there's an error, log the full response for more details console.error('Response Status:', error.response.status); console.error('Response Body:', JSON.stringify(error.response.body, null, 2)); } } } // Call the function to update the grantee list updateGranteeList(); ``` Example output: ```bash Grantee List Updated Successfully: Updated Reference: a029324c42e7911032b83155f487d545b6e07b521a90fce90a266f308c0a455417e71bc03621868da2f6e84357ba772cb03b408fce79862b03d2e082004eccd8 Updated History Reference: d904f0790acb7edfda6a078176d64ec026b40298bfdbceb82956533e31489fcd ``` ## Get Grantees List In order to view the members of our grantees list we need to use the 64 byte `ref` returned when we create or update a list. We will view both our original list and the updated list based on the original list using the respective `ref` from each list: :::info The grantee list is encrypted, and only the owner can view the grantee list, make sure to use the owner node when using the `bee.grantee.get()` method. ::: #### Example Script: The example script below performs the following operations: 1. Initializes a Bee client. 2. Defines the 64 byte `ref` of two existing grantee lists, copied from the results of our previous example scripts. 3. Calls `bee.grantee.get()` for each `ref` to retrieve the corresponding grantee list. 4. Logs the status, status text, and list of grantee public keys in compressed hex format. ```js // Initialize Bee instance const bee = new Bee('http://localhost:1633'); // Grantee list references (the reference returned from the `bee.grantee.create()` function) const granteeListRef_01 = new Reference('69da034fdae049eed9a22ec48b98a08ed5d363d48076f88c44ffe3367a18e306cae6aaf1cfce72d59262b9fb9293e15469c01c6a2626bb62478116cc98fb303b'); const granteeListRef_02 = new Reference('a029324c42e7911032b83155f487d545b6e07b521a90fce90a266f308c0a455417e71bc03621868da2f6e84357ba772cb03b408fce79862b03d2e082004eccd8'); // Function to get the grantee list async function getGranteeList(granteeListRef) { try { // Call bee.grantee.get() with the reference const result = await bee.grantee.get(granteeListRef); // Log the full response console.log('Grantee List Retrieved:'); console.log('Status:', result.status); console.log('Status Text:', result.statusText); // Log the grantee lists as arrays of their hex string representations console.log('Grantees:', result.grantees.map(grantee => grantee.toCompressedHex())); } catch (error) { console.error('Error retrieving grantee list:', error); } } // Call the function to fetch the grantee list getGranteeList(granteeListRef_01); getGranteeList(granteeListRef_02); ``` Example output: ```bash Grantee List Retrieved: Status: 200 Status Text: OK Grantees: [ '027d0c4759f689ea3dd3eb79222870671c492cb99f3fade275bcbf0ea39cd0ef6e' ] Grantee List Retrieved: Status: 200 Status Text: OK Grantees: [ '027d0c4759f689ea3dd3eb79222870671c492cb99f3fade275bcbf0ea39cd0ef6e', '03636056d1e08f100c5acaf14d10070102de9444c97b2e8215305ab3e97254ede6' ] ``` The first list of grantees contains the public key we gave access to when we created the list, while the second contains that key plus the one we added when we created the second list. ## Upload With ACT We can upload our content with either of the two lists we created, depending on which set of users we wish to give access to. In the example below, we use both lists. #### Example Script: The example script below performs the following operations: 1. Initializes a Bee client. 2. Defines a postage batch ID and two ACT grantee list 32 byte `historyref` hashes returned from the operations in the previous examples. 3. Defines a string to upload as a sample file. 4. Calls `bee.file.upload()` twice with ACT enabled, specifying a `historyRef` each time to enforce access control. 5. Logs the resulting Swarm reference and history reference after each upload. :::note ACT applies to data and file uploads. Bee ignores ACT on `/chunks` and `/soc`, so the `act` and `actHistoryAddress` options are deprecated on `bee.chunk.upload`, SOC writers and `bee.messaging.gsocSend`, and will be removed. ::: ```js // Initialize Bee instance const bee = new Bee('http://localhost:1633'); // Your postage batch ID (replace with a valid one) const postageBatchId = new BatchId('0258a225fe8da54cc6537eb8b12fcf6706c7873dbe19b9381d31729aa0405398'); // Grantee list reference (the reference returned from the `bee.grantee.create()` function) const historyRef_01 = new Reference('18d6f58a1d3c8253a5fc47023d49e9011236ead43724e595e898e1b422b77b19'); const historyRef_02 = new Reference('d904f0790acb7edfda6a078176d64ec026b40298bfdbceb82956533e31489fcd'); // Sample data to upload const fileData = 'This is a sample string that will be uploaded securely using ACT.'; async function uploadWithACT(historyRef) { try { // Upload the string with ACT enabled const result = await bee.file.upload(postageBatchId, fileData, 'samplefile.txt', { act: true, // Enable ACT for the uploaded data actHistoryAddress: historyRef, // Provide the grantee list reference for ACT contentType: 'text/plain', }); console.log('File uploaded successfully with ACT:'); console.log('Reference:', result.reference.toHex()); console.log("History reference") console.log(result.historyAddress.value.toHex()) } catch (error) { console.error('Error uploading file with ACT:', error); } } // Call the function to upload the file with each `historyref` uploadWithACT(historyRef_01); uploadWithACT(historyRef_02); ``` Example output: ```bash File uploaded successfully with ACT: Reference: e227acea84e1d55e90baa93a698e79577a5b1c54513925b61476386798b41728 History reference 18d6f58a1d3c8253a5fc47023d49e9011236ead43724e595e898e1b422b77b19 File uploaded successfully with ACT: Reference: e227acea84e1d55e90baa93a698e79577a5b1c54513925b61476386798b41728 History reference d904f0790acb7edfda6a078176d64ec026b40298bfdbceb82956533e31489fcd ``` The reference hash is the same for each upload since the content is the same. The reference hash along with a `historyref` and the uploader's public key are required in order to access the content uploaded with ACT. You can choose which `historyref` to share depending on which set of public keys you wish to authorize to download the content. ## Download With ACT In order to download using ACT, we must pass in the public key from the grantee list creator along with the file reference and history reference returned from the file upload operation: #### Example Script: The example script below performs the following operations: 1. Initializes a Bee client. 2. Defines a publisher public key and associated file reference + history references for ACT-protected content using the references returned from the upload operation. 3. Calls `bee.file.download()` with ACT options (`actPublisher` and `actHistoryAddress`) to access protected data. 4. Logs the decoded file content. ```js // Initialize Bee instance const bee = new Bee('http://localhost:1633') // Publisher public key used during upload const publisherPublicKey = new PublicKey('0295562f9c1013d1db29f7aaa0c997c4bb3f1fc053bd0ed49a3d98584490cc8f96'); // File reference and history reference returned from upload operation const fileRef_01 = new Reference('e227acea84e1d55e90baa93a698e79577a5b1c54513925b61476386798b41728'); const historyRef_01 = new Reference('18d6f58a1d3c8253a5fc47023d49e9011236ead43724e595e898e1b422b77b19'); // Function to download ACT-protected content async function downloadWithACT(fileRef, historyRef, publisherPubKey) { try { const result = await bee.file.download(fileRef, '', { actPublisher: publisherPubKey, actHistoryAddress: historyRef }) console.log('Content:', result.data.toUtf8()) } catch (error) { console.error(`Error downloading from reference ${fileRef}:`, error) } } downloadWithACT( fileRef_01, historyRef_01, publisherPublicKey ) ``` Example terminal output: ```bash Content: This is a sample string that will be uploaded securely using ACT. ``` In the example above, we used the history reference from the file uploaded using the grantees list with only one public key included (`027d0c4759f689ea3dd3eb79222870671c492cb99f3fade275bcbf0ea39cd0ef6e`), so only the node with that public key can retrieve and decrypt it. If any other node attempts to download this content then a 404 error will be returned. --- ## Buying Storage Storage on Swarm is rented by purchasing "postage stamp batches". Each batch reserves a certain amount of storage space on Swarm for the lifetime of the batch. The cost of the batch increases with the storage size and duration. ### Requirements To use the example scripts below, you need: - An instance of `bee-js`'s `Bee` [initialized](./getting-started.md) using the API endpoint of a currently operating Bee node ### Checking Storage Costs We can use the `bee.storage.getCost` method along with our desired storage `Size` (amount of data to upload) and `Duration` (the batch lifetime) to get an estimated storage cost: :::tip The per-byte storage cost decreases as the storage `Size` of the batch increases, so it is more cost effective to purchase a single large batch rather than multiple smaller ones. Costs remain constant with respect to changes in total `Duration`, however, so there is no discount for purchasing batches with a longer lifetime. ::: ```javascript const bee = new Bee('http://localhost:1633') // Get cost in BZZ to store 1 GB for ~1 day const bzz = await bee.storage.getCost(Size.fromGigabytes(1), Duration.fromDays(1)) // Prints "0.325" given the storage cost of 44908 PLUR at time of writing console.log(bzz.toSignificantDigits(3)) ``` :::warning The actual lifetime of the batch may be higher or lower than the specified `Duration` due to Swarm's dynamic pricing model. The amount that the price can change each day is limited, however, so you don't need to worry about a rapid increase in price causing your batch to unexpectedly expire over the course of a few hours. You can view the current price of storage on [Swarmscan](https://swarmscan.io/). ::: ### Purchasing Storage The `bee.storage.buy` method abstracts away the lower level details of postage batches, letting you ask for a size and a duration instead of a depth and an amount. :::tip When purchasing storage with `bee.storage.buy`, a postage batch will be bought with *at least* enough space to upload the specified amount of data. However since storage on Swarm comes in [***discrete sizes***](./buying-storage.md#batch-size-breakpoints), the actual amount of space will likely be greater than specified. ::: The `bee.storage.buy` method takes instances of the [`Size` and `Duration` utility classes](./buying-storage.md#utility-classes) and purchases a postage batch which can upload *at least* as much data as the given `Size` and store it for the given `Duration` (the actual duration of storage may be longer or shorter depending on the change in storage price over time), and then save the postage batch data locally. The transaction usually only takes a few seconds but may take up to a minute. ```javascript const bee = new Bee('http://localhost:1633') // Purchase a batch to store 1 GB const batchId = await bee.storage.buy(Size.fromGigabytes(1), Duration.fromDays(1)) ``` Once the purchase transaction is complete, the method will return a unique postage batch id. The lifetime of the batch starts counting down from the moment of purchase. The batch in the example above will expire in about 24 hours. ### Extending Storage Size :::tip Just as with buying storage, since storage comes only in [***discrete sizes***](./buying-storage.md#batch-size-breakpoints), the actual amount of additional space when extending the storage size of an existing batch will typically be greater than specified. ::: If we need to upload more data, then we can extend a batch's storage size using the `bee.storage.extendSize` method. Note that in order to increase the batch size using the `bee.storage.extendSize` method, you must choose a size which is above the current [batch's size breakpoint](./buying-storage.md#batch-size-breakpoints). :::tip As mentioned [below](./buying-storage.md#batch-size-breakpoints), the per-byte cost decreases as the storage size of a batch increases, so it's more cost effective to increase the storage size of an existing batch than to buy a new, smaller one. The exception to this rule is if we no longer wish to store the previously uploaded data. In that case we should buy a new postage batch, since extending the size of an existing batch would mean continuing to pay for the already uploaded data which we no longer need. ::: First we estimate the cost to extend the storage size with the `bee.storage.getSizeExtensionCost` method: ```javascript const bee = new Bee('http://localhost:1633') // Request all local postage batches const batches = await bee.stamp.getAll() const batchId = batches[0].batchID // Instantiate a Size instance for 5 GB const newSize = Size.fromGigabytes(5) // Return an instance of the BZZ class const sizeExtensionCost = await bee.storage.getSizeExtensionCost(batchId, newSize) // Use the BZZ.toDecimalString instance method to convert to a readable BZZ string const cost = sizeExtensionCost.toDecimalString() // Prints current cost to increase size console.log(cost) ``` If the price is acceptable, then we can proceed to extend the batch size using `bee.storage.extendSize`: ```javascript const bee = new Bee('http://localhost:1633') // Request all local postage batches const batches = await bee.stamp.getAll() // Print results to the terminal console.log(batches) // Get batch ID of first batch in list const batchId = batches[0].batchID // Instantiate a Size instance for 5 GB const newSize = Size.fromGigabytes(5) // Extends batch size and returns the batch ID const result = await bee.storage.extendSize(batchId, newSize) // Log result if successful console.log(result) ``` We can check that we successfully extended the batch size by [checking batch status](./buying-storage.md#checking-batch-status): ```javascript [ { batchID: BatchId { bytes: [Uint8Array], length: 32 }, utilization: 0, usable: true, label: '', depth: 22, amount: '1714407552', bucketDepth: 16, blockNumber: 39145214, immutableFlag: true, usage: 0, usageText: '0%', size: Size { bytes: 7070000000 }, remainingSize: Size { bytes: 7070000000 }, theoreticalSize: Size { bytes: 17179869184 }, duration: Duration { seconds: 94453 } } ] ``` Here we can see that our batch `size` was successfully extended from ~2.38 GB to ~7.07 GB. *See [below](./buying-storage.md#batch-size-breakpoints) to understand why `size` was extended to ~7.07 GB even though 5 GB was used as input.* ### Extending Storage Duration If we want our data to remain available on Swarm for a longer period of time, we can extend the duration of a postage batch using the `bee.storage.extendDuration` method. Extending the duration means adding more BZZ to the batch so that the data stays alive longer on the network. Before extending the duration, we can estimate the cost using the `bee.storage.getDurationExtensionCost` method: ```javascript const bee = new Bee('http://localhost:1633') // Request all local postage batches const batches = await bee.stamp.getAll() // Select the batch ID of the first batch in the list const batchId = batches[0].batchID // Create a new Duration instance for 0.01 days const additionalDuration = Duration.fromDays(.01) // Estimate the cost of extending the duration const durationExtensionCost = await bee.storage.getDurationExtensionCost(batchId, additionalDuration) // Convert the BZZ value into a readable string const cost = durationExtensionCost.toDecimalString() // Print the estimated cost console.log(cost) ``` Once we know the cost and decide to proceed, we can use `bee.storage.extendDuration` to extend the batch duration: ```javascript const bee = new Bee('http://localhost:1633') // Request all local postage batches const batches = await bee.stamp.getAll() // Select the batch ID of the first batch in the list const batchId = batches[0].batchID // Create a Duration instance for 0.01 additional days const additionalDuration = Duration.fromDays(.01) // Extend the duration of the batch const result = await bee.storage.extendDuration(batchId, additionalDuration) // Log the result console.log(result) ``` We can verify that the extension was successful by [checking the batch status](./buying-storage.md#checking-batch-status). You'll notice the `duration` value on the batch will have increased, reflecting the newly extended storage time: ```javascript [ { batchID: BatchId { bytes: [Uint8Array], length: 32 }, utilization: 0, usable: true, label: '', depth: 22, amount: '1722164236', bucketDepth: 16, blockNumber: 39145214, immutableFlag: true, usage: 0, usageText: '0%', size: Size { bytes: 7070000000 }, remainingSize: Size { bytes: 7070000000 }, theoreticalSize: Size { bytes: 17179869184 }, duration: Duration { seconds: 94132 } } ] ``` Here we can see that the `duration` value (measured in seconds) has increased, confirming that the batch will now remain alive on the Swarm network for longer. :::tip If you're storing important or long-lived data, it's a good idea to periodically check and extend the duration of your batches to ensure your data doesn't expire unexpectedly. ::: ### Estimating Combined Size and Duration Extension Cost If we want to **increase both the storage size and duration** of a postage batch, we can use the `bee.storage.getExtensionCost` method to estimate the **total cost** of the extension. This is useful when you're planning to keep data alive for longer *and* want to increase capacity for uploading more data at the same time. The `bee.storage.getExtensionCost` method combines size and duration into a single cost calculation, making it easier to understand the overall expense upfront. Here’s how to use it: ```javascript const bee = new Bee('http://localhost:1633') // Request all local postage batches const batches = await bee.stamp.getAll() // Choose a batch to extend const batchId = batches[0].batchID // Define a new desired size (e.g., 10 GB) const newSize = Size.fromGigabytes(10) // Define a new additional duration (e.g., 14 days) const additionalDuration = Duration.fromDays(14) // Estimate total BZZ cost for extending both size and duration const totalCost = await bee.storage.getExtensionCost(batchId, newSize, additionalDuration) // Convert to a readable string const cost = totalCost.toDecimalString() // Print total estimated cost console.log(cost) ``` This method helps you determine if it's more economical to **extend** an existing batch or **create a new one**, especially when both dimensions—storage and time—need to grow. :::tip If you're unsure whether to extend a batch or start fresh, compare the output of `bee.storage.getExtensionCost` with the cost of a new batch using the [Postage Stamp Pricing Guide](./buying-storage.md#batch-size-breakpoints). In many cases, extending is cheaper, especially for larger and longer-lived batches. ::: If you're happy with the cost, you can then proceed to extend the **size** and **duration** individually by calling `bee.storage.extendSize` and `bee.storage.extendDuration` as shown in the previous sections. ### Checking Batch Status You can check the status of purchased batches using the `bee.stamp.getAll` method: ```javascript const bee = new Bee('http://localhost:1633') // Request all local postage batches const batches = await bee.stamp.getAll() // Print results to the terminal console.log(batches) ``` The results printed to the terminal will include all the currently valid postage batches we've purchased: ```bash [ { batchID: BatchId { bytes: [Uint8Array], length: 32 }, utilization: 0, usable: true, label: '', depth: 21, amount: '931958784', bucketDepth: 16, blockNumber: 39105960, immutableFlag: true, usage: 0, usageText: '0%', size: Size { bytes: 2380000000 }, remainingSize: Size { bytes: 2380000000 }, theoreticalSize: Size { bytes: 8589934592 }, duration: Duration { seconds: 84348 } } ] ``` We can disregard many of these values since they are only needed for advanced usage. There are several values we do need to pay attention to however: - `usable` - it takes a short time for a batch to become usable (usually less than a minute) after purchase. Once usable, `usable` will change from `false` to `true`. - `usage` - indicates how much of the batch has been used as a value between `0` and `1`. - `usageText` - converts the `usage` value to a percentage value rounded to the nearest whole number which is then converted to text. - `size` - the amount of data in bytes which the batch can safely store. - `remainingSize` - the amount of data in bytes remaining from `size` which is still available to be used. - `duration` - an estimate of the remaining batch lifetime in seconds. :::tip Note that although 1 GB was specified as input for `bee.storage.buy`, the `size` value is ~2.38 GB. Refer to the [section about batch sizes](./buying-storage.md#batch-size-breakpoints) below to understand why. ::: ### Selecting a Batch Any method in `bee-js` which writes data to Swarm requires the batch ID of a valid, usable postage batch with remaining space to upload data. The example script below exports a function which looks for the first usable postage batch with remaining space and returns the ID of the batch. :::tip notice This function is used throughout the examples here in the docs. ::: ```javascript const bee = new Bee('http://localhost:1633') export async function getBatch(bee, criteriaFn) { const batches = await bee.stamp.getAll() const matchingBatch = batches.find(criteriaFn) if (!matchingBatch) { throw new Error('No postage batch matched the provided criteria.') } return matchingBatch.batchID.toString() } ``` To use it, save the script to a file called `getBatch.js` so we can import it in our other scripts. ```javascript const bee = new Bee('http://localhost:1633') // Define the selection criteria as a named function function isUsableWithFreeSpace(batch) { return batch.usable && batch.remainingSize.toBytes() > 0 } const batchId = await getBatch(bee, isUsableWithFreeSpace) ``` If you need a batch with specific characteristics (such as a batch with at least 10 GB remaining space or a mutable batch), then you should [inspect](./buying-storage.md#checking-batch-status) your postage batches' status using `bee.stamp.getAll` in order to check if a batch with your desired characteristics exists and return its ID. ### Batch Size Breakpoints Batches are bought in discrete size intervals. Each interval corresponds to a batch *depth*, and each depth doubles the theoretical volume of the batch. Only part of a batch's theoretical volume can be filled in practice, because chunks are distributed unevenly across the batch's buckets. The share that can be used is the *effective volume*, and it grows with depth: a depth 17 batch can only use a hundredth of a percent of its theoretical volume, while a depth 34 batch can use almost 90% of it. This is why the per-byte cost of storage falls sharply as batches get bigger. *The table below reflects the breakpoints `bee-js` uses by default, which are optimized for encrypted uploads with medium erasure coding. Pass the `encryption` and `erasureCodeLevel` arguments to `bee.storage.buy` and `bee.storage.getCost` to use the exact table for a different combination.* | Depth | Theoretical Volume | Effective Volume | Utilization | Relative Cost / Effective GB | | ----- | ------------------ | ---------------- | ----------- | ---------------------------- | | 17 | 536.87 MB | 40.89 kB | 0.01% | 11783x | | 18 | 1.07 GB | 6.09 MB | 0.57% | 158x | | 19 | 2.15 GB | 102.49 MB | 4.77% | 19x | | 20 | 4.29 GB | 628.91 MB | 14.64% | 6.1x | | 21 | 8.59 GB | 2.38 GB | 27.71% | 3.2x | | 22 | 17.18 GB | 7.07 GB | 41.15% | 2.2x | | 23 | 34.36 GB | 18.24 GB | 53.09% | 1.7x | | 24 | 68.72 GB | 43.04 GB | 62.63% | 1.4x | | 25 | 137.44 GB | 96.50 GB | 70.21% | 1.3x | | 26 | 274.88 GB | 208.52 GB | 75.86% | 1.2x | | 27 | 549.76 GB | 435.98 GB | 79.30% | 1.1x | | 28 | 1.10 TB | 908.81 GB | 82.66% | 1.1x | | 29 | 2.20 TB | 1.87 TB | 85.04% | 1.1x | | 30 | 4.40 TB | 3.81 TB | 86.63% | 1.0x | | 31 | 8.80 TB | 7.73 TB | 87.88% | 1.0x | | 32 | 17.59 TB | 15.61 TB | 88.73% | 1.0x | | 33 | 35.18 TB | 31.43 TB | 89.33% | 1.0x | | 34 | 70.37 TB | 63.15 TB | 89.74% | 1.0x | The last column is the cost of one effective gigabyte relative to the cheapest depth in the table. It is derived from the volumes rather than from any particular BZZ price, so it holds regardless of what storage currently costs. Use `bee.storage.getCost` for actual prices. When purchasing a batch or estimating its price, `bee-js` will round up to the nearest effective volume. For example, if the `bee.storage.buy` method is used to buy a batch with 1 GB as input, `bee-js` will round up to depth 21 and buy a batch with 2.38 GB effective volume. If 5 GB is used as input, `bee-js` will round up to depth 22 and its 7.07 GB, since 5 GB does not fit into the 2.38 GB that depth 21 offers. Refer to the [Bee documentation](https://docs.ethswarm.org/docs/concepts/incentives/postage-stamps#effective-utilisation-table) for a more in-depth understanding of batch utilization. ### Utility Classes #### `Size` The `Size` class represents a storage size in **bytes**, with helper methods for creating and converting values. ##### Creating a Size instance The class includes several *static* methods for creating an instance of the `Size` class: - `Size.fromBytes` - `Size.fromKilobytes` - `Size.fromMegabytes` - `Size.fromGigabytes` - `Size.parseFromString` ```javascript // Create a Size instance from raw bytes const sizeA = Size.fromBytes(5000000000) // Or from gigabytes const sizeB = Size.fromGigabytes(5) // → 5 GB = 5,000,000,000 bytes // Or from a human readable string (case insensitive, whitespace ignored) const sizeC = Size.parseFromString('1.5gb') ``` :::info `Size` uses 1000 rather than 1024 as the base for unit conversions, which keeps it consistent with the effective utilization table above. ::: ##### Converting and formatting The class also includes three *instance* methods for getting the value from an existing `Size` instance as either raw bytes, gigabytes, or formatted text: - `size.toBytes` - `size.toGigabytes` - `size.toFormattedString` ```javascript // Using `sizeB` from the previous example sizeB.toBytes() // → 5000000000 sizeB.toGigabytes() // → 5 sizeB.toFormattedString() // → '5.000 GB' ``` #### `Duration` The `Duration` class represents a length of time in **seconds**, with helper methods for creating and converting durations in various common time units. :::tip All of the helper methods for `Duration` take numbers as input except for `toEndDate` and `fromEndDate`, which both take a [`Date`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date) object as input. ::: ##### Creating a Duration instance The class includes several *static* methods for creating a `Duration` instance from values like milliseconds, seconds, days, or even from dates: - `Duration.fromMilliseconds` - `Duration.fromSeconds` - `Duration.fromHours` - `Duration.fromDays` - `Duration.fromWeeks` - `Duration.fromYears` - `Duration.fromEndDate` - `Duration.parseFromString` ```javascript // Create a duration of 3 days const durationA = Duration.fromDays(3) // Create a duration from now until a future date const endDate = new Date('2027-04-01T12:00:00Z') const durationB = Duration.fromEndDate(endDate) // Or from a human readable string (case insensitive, whitespace ignored) const durationC = Duration.parseFromString('2 weeks') ``` ##### Converting and formatting The class also includes several *instance* methods for converting a `Duration` instance into different time units or for getting a future date from a starting point: - `duration.toSeconds` - `duration.toHours` - `duration.toDays` - `duration.toWeeks` - `duration.toYears` - `duration.toEndDate` ```javascript // Using `durationA` from the previous example durationA.toSeconds() // → 259200 durationA.toDays() // → 3 durationA.toEndDate() // → Date object 3 days from now // You can also specify a custom starting date const startDate = new Date('2027-01-01T00:00:00Z') durationA.toEndDate(startDate) // → Date object 3 days after Jan 1 ``` This class is useful when: - Setting how long data should remain available in Swarm - Estimating or displaying expiration time for postage batches - Working with `bee.storage.buy`, `bee.storage.getCost`, or `bee.storage.extendDuration` --- ## Chequebook Management On Swarm, when downloading data from the network, nodes pay each other for forwarding data in the form of cheques. If you plan to download a significant amount of data from the network, it is important that you fund your chequebook with BZZ so your node can issue and then pay for cheques. You can also fund your chequebook by running a full node and getting paid in BZZ for forwarding chunks to other nodes, though this may not be enough depending on your download volume. :::tip If using your node for downloads, it's recommended to actively monitor your node's chequebook balance and top it up once the balance begins to run low. ::: ### Requirements To use the example scripts below, you need: - An instance of `bee-js`'s `Bee` [initialized](./getting-started.md) using the API endpoint of a currently operating ***FULL*** Bee node. - Some BZZ to fund your chequebook. ### 1. Deposit to Chequebook from Node Wallet Deposits a specified amount of BZZ into the chequebook from your node wallet. This ensures that your node can issue cheques for transactions. ```javascript const bee = new Bee('http://localhost:1633') const amount = BZZ.fromDecimalString('1') // Deposit 1 BZZ const transactionHash = await bee.chequebook.deposit(amount) console.log('Deposit transaction hash:', transactionHash.toHex()) ``` ```bash Deposit transaction hash: 85362b9d3ed2ba520b12e4e6523546832064365621ece8b3881cd1dfd40365ec ``` ### 2. Get Chequebook Balance Retrieves the current balance of the chequebook. This helps you ensure that you have enough BZZ to continue issuing cheques. ```javascript const chequebookBalance = await bee.chequebook.getBalance() console.log('Chequebook Balance:', chequebookBalance) ``` ```bash Chequebook Balance: { availableBalance: BZZ { state: FixedPointNumber { value: 10000000000000000n, scale: 16 } }, totalBalance: BZZ { state: FixedPointNumber { value: 10000000000000000n, scale: 16 } } } ``` ### 3. Withdraw from Chequebook to Node Wallet Withdraws a specified amount of BZZ from the chequebook to the node wallet. You may need to withdraw if you want to transfer BZZ to another account or for other uses. ```javascript const bee = new Bee('http://localhost:1633') const amountToWithdraw = BZZ.fromDecimalString('1') // Withdraw 1 BZZ const withdrawalHash = await bee.chequebook.withdraw(amountToWithdraw) console.log('Withdraw transaction hash:', withdrawalHash.toHex()) ``` ```bash Withdraw transaction hash: 7674b1070406f60c317d26d5155521d674e5494db8f90cabbf46de0e22fc5556 ``` ### 4. Get Cheques Retrieves information about the last sent and received cheques from peers, either for all peers or for a specific peer. #### Get Last Cheques for All Peers This method retrieves the most recent cheques sent or received for all peers. Each entry includes details like the recipient, chequebook address, and payout amount. ```javascript const lastCheques = await bee.cheque.getAllLatest() console.log('Last Cheques for all peers:', lastCheques) ``` ```bash Last Cheques for all peers: { lastcheques: [ { peer: '10f68a7f7fe8b85e04ae0c869c02852f1b568b145c7f59179feef0601d9f1bf7', lastreceived: null, lastsent: { beneficiary: [EthAddress], chequebook: [EthAddress], payout: [BZZ] } }, ... ] } ``` #### Get Cheques for a Specific Peer Fetches the last cheques for a particular peer. This can help you track your cheques for specific interactions. ```javascript const peerAddress = '10f68a7f7fe8b85e04ae0c869c02852f1b568b145c7f59179feef0601d9f1bf7' const lastChequesForPeer = await bee.cheque.getAllLatestForPeer(peerAddress) console.log(`Last cheques for peer ${peerAddress}:`, lastChequesForPeer) ``` ```bash Last cheques for peer 10f68a7f7fe8b85e04ae0c869c02852f1b568b145c7f59179feef0601d9f1bf7: { peer: '10f68a7f7fe8b85e04ae0c869c02852f1b568b145c7f59179feef0601d9f1bf7', lastreceived: null, lastsent: { beneficiary: EthAddress { bytes: [Uint8Array], length: 20 }, chequebook: EthAddress { bytes: [Uint8Array], length: 20 }, payout: BZZ { state: [FixedPointNumber] } } } ``` ### 5. Cash-out Cheque Cash out a cheque for a specific peer. This method allows you to retrieve funds from a cheque that has been issued to you by a peer. #### Cash Out the Last Cheque ```javascript const peerAddress = '10f68a7f7fe8b85e04ae0c869c02852f1b568b145c7f59179feef0601d9f1bf7' const transactionId = await bee.cheque.cashoutLast(peerAddress) console.log('Cashout transaction ID:', transactionId) ``` ```bash Cashout transaction ID: dabb1d1b129d4c6317b96db23d9ca2d417aec9961f9a4d52f6b24e165b525eb8 ``` --- ## Getting Started ## About *bee-js* `bee-js` simplifies development on Swarm by abstracting away many of the finer details and quirks of the Bee API so that you can focus on building your dream DAPP with minimal hassle. It's the easiest way to get started developing on Swarm. ## Installation ```sh npm install @ethersphere/bee-js --save ``` ```sh yarn add @ethersphere/bee-js --save ``` ```html ``` After that you need to import the Bee class and create a bee instance connecting to your Bee node (here we assume it runs on localhost on the default port). Be aware that the constructor throws an exception if you pass an invalid URL. ```js const bee = new Bee('http://localhost:1633') ``` That’s it! Now you can use the `bee` object. Operations are grouped into namespaces by subject, so uploading raw data is `bee.data.upload(...)`, listing postage batches is `bee.stamp.getAll(...)`, and so on. The [SDK Overview](./overview.md) lists every namespace. :::info Upgrading from v12? Version 13 moved these methods out of the flat `bee.` surface into namespaces, and moved the Swarm primitives into a separate `@ethersphere/core-sdk` package. A codemod rewrites the call sites for you. See [Migrating from v12 to v13](./migrating-to-v13.md). ::: :::info Run your own Bee node You can find out more about running a Bee node in the [Bee docs](https://docs.ethswarm.org/docs/installation/quick-start) ::: :::tip Using ` ``` ::: :::caution Browser apps and CORS From Bee 2.8.3, a node rejects `POST`, `PUT`, `PATCH` and `DELETE` requests from a browser page on another origin with `403 Forbidden`, unless that origin is listed in the node's `cors-allowed-origins` option. Uploads, stamp purchases and other write calls from a web app need the app's origin in that list: ```sh bee start --cors-allowed-origins="https://my-app.example" ``` Node.js scripts are not affected, because they send no `Origin` header. ::: ## Quickstart With *create-swarm-app* The `create-swarm-app` tool makes it easy to get started developing on Swarm. With a single command, it generates the basic scaffolding for a `bee-js` project in your chosen development environment (CommonJS, ESM, TypeScript, or Vite + TypeScript). :::note WSL WARNING The `create-swarm-app` tool is compatible with Windows, macOS, and Linux. However, using it in combination with [WSL](https://learn.microsoft.com/en-us/windows/wsl/) is discouraged due to potential compatibility issues that may require additional troubleshooting. That said, the `bee-js` library itself works seamlessly within WSL. If you prefer to develop your project using WSL, you can use `create-swarm-app` to generate the project files on the Windows side, then move them into your WSL environment for development. ::: You can use [`create-swarm-app`](https://www.npmjs.com/package/create-swarm-app) to quickly set up scaffolding for a `bee-js` project with the following command: ```bash npm init swarm-app@latest app-name app-type ``` Replace "app-name" with your app's name, and "app-type" with the type of app you want. Supported types are `node`, `node-esm`, `node-ts` and `vite-tsx`. Start a Swarm project using TypeScript: ```bash npm init swarm-app@latest my-dapp node-ts ``` Your project structure will look like: ```bash . ├── package.json ├── src │   ├── config.ts │   └── index.ts └── tsconfig.json ``` or using Vite and TypeScript: ```bash npm init swarm-app@latest my-dapp vite-tsx ``` Your project structure will look like: ```bash tree . . ├── index.html ├── package.json ├── src │   ├── App.tsx │   ├── config.ts │   └── index.tsx └── tsconfig.json ``` The exact results will differ slightly depending on which `app-type` you use, but they will all include a `config.ts` or `config.js` file where the Bee node's API endpoint must be specified. The endpoint is set to the default Bee API endpoint of `http://localhost:1633`. If your node uses a different endpoint, you will need to update it in the config file. --- ## GSOC The GSOC (Graffiti Several Owner Chunk) feature allows a **full node** to receive messages from many other nodes using a shared Single Owner Chunk (SOC). This enables real-time messaging over Swarm. ## Overview GSOC messages are updates to a pre-mined SOC that lands in the **neighborhood** of the recipient node. Only full nodes receive these updates because light nodes do not sync neighborhood chunks. However, **any node** (light or full) can send GSOC messages. ### GSOC vs PSS GSOC shares some similarities with PSS: both allow full nodes to receive messages from other nodes. However, there are several key differences: - Unlike PSS, **GSOC only needs to mine the target chunk once**—multiple messages reuse it, making it **faster, cheaper**, and **more efficient** for recurring updates. - Unlike PSS, **no encryption** is used by default, making it unsuitable for handling sensitive data. - Unlike PSS, **GSOC chunks are not meant to be retrieved directly**. The SOC used to initiate a GSOC connection only serves to listen for incoming messages. Those messages never actually update the SOC, because double-signing a SOC is undefined behavior. ## Requirements To use the example scripts below, you need: - A Bee full node with a fully synced reserve for receiving GSOC messages. - A light node for sending GSOC messages. - The batch ID of a usable postage batch. If you don't have one already, you will need to [buy a batch](./buying-storage.md#purchasing-storage) to upload data. If you do have one, you will need to [get and save](./buying-storage.md#selecting-a-batch) its batch ID. ## Create an Identifier (Receiver and Sender) Identifiers in GSOC are similar to topics in PSS — they define the stream of messages a receiver node is subscribed to. The sender must use the same identifier so that their messages are received. Each identifier is 32 bytes. It can be initialized from a 32-byte hex string of your choice or created from any arbitrary string using the `Identifier` class. You can also use the zero-initialized `NULL_IDENTIFIER` as a default identifier for cases where you don't need a unique identifier: ```js // Use default (all zeros): const zeroIdentifier = NULL_IDENTIFIER // From a hex string: const hexIdentifier = new Identifier('6527217e549e84f98e51b1d8b1ead62ff5cad59acd9713825754555d6975f103') // From a human-readable string: const namedIdentifier = Identifier.fromString('chat:v1') ``` - `NULL_IDENTIFIER` is 32 zero bytes. Use it for quick testing or when uniqueness doesn't matter. - Use any 32-byte hex string to initialize a new `Identifier` object. - Use `Identifier.fromString()` to derive an identifier from a string of your choice, which allows for easy-to-remember, human-readable identifiers such as `"notifications"` or `"chat:user1"`. :::caution Don't pass `NULL_IDENTIFIER` to `Identifier.fromString()` `NULL_IDENTIFIER` is already a 32-byte value, not a string. `Identifier.fromString(NULL_IDENTIFIER)` hashes its string representation with keccak256 and produces a completely different, non-zero identifier, so a listener and a sender that do this inconsistently will never match. Pass `NULL_IDENTIFIER` straight through instead. ::: ## Get Target Overlay (Receiver Node) This step **is performed by the receiving full node** to retrieve its overlay address. This overlay address is then shared with the sender node to use as a target overlay for its GSOC messages: ```js const bee = new Bee('http://localhost:1633') async function checkAddresses() { const addresses = await bee.connectivity.getNodeAddresses() console.log('Node Addresses:') console.log('Overlay:', addresses.overlay.toHex()) console.log('Ethereum:', addresses.ethereum.toHex()) console.log('Public Key:', addresses.publicKey.toHex()) console.log('PSS Public Key:', addresses.pssPublicKey.toHex()) console.log('Underlay:', addresses.underlay) } checkAddresses() ``` Example output: ```bash Node Addresses: Overlay: 1e2054bec3e681aeb0b365a1f9a574a03782176bd3ec0bcf810ebcaf551e4070 Ethereum: 9a73f283cd9211b96b5ec63f7a81a0ddc847cd93 Public Key: 7d0c4759f689ea3dd3eb79222870671c492cb99f3fade275bcbf0ea39cd0ef6e25edd43c99985983e49aa528f3f2b6711085354a31acb4e7b03559b02ec868f0 PSS Public Key: 5ade58d20be7e04ee8f875eabeebf9c53375a8fc73917683155c7c0b572f47ef790daa3328f48482663954d12f6e4739f748572c1e86bfa89af99f17e7dd4d33 Underlay: [ '/ip4/127.0.0.1/tcp/1634/p2p/QmcpSJPHuuQYRgDkNfwziihVcpuVteoNxePvfzaJyp9z7j', '/ip4/172.17.0.2/tcp/1634/p2p/QmcpSJPHuuQYRgDkNfwziihVcpuVteoNxePvfzaJyp9z7j', '/ip6/::1/tcp/1634/p2p/QmcpSJPHuuQYRgDkNfwziihVcpuVteoNxePvfzaJyp9z7j' ] ``` The `Overlay` should be saved and shared with sender nodes. ## Set Up a Listener (Receiver Node) This must be run on a full node. It mines a key that lands within its own neighborhood and starts listening. :::caution `onClose` is required The handler passed to `bee.messaging.gsocSubscribe()` must provide all three callbacks: `onMessage`, `onError` and `onClose`. Leaving `onClose` out throws `Expected function for onClose, got: undefined` before the subscription is opened. ::: ```js const bee = new Bee('http://localhost:1633') const identifier = NULL_IDENTIFIER async function listen() { const { overlay } = await bee.connectivity.getNodeAddresses() // The signer is initialized using the receiving node's own overlay and chosen identifier const signer = bee.messaging.gsocMine(overlay, identifier) // A GSOC subscription is established using the blockchain address derived from the signer and the identifier const subscription = bee.messaging.gsocSubscribe(signer.publicKey().address(), identifier, { // A callback function is used to handle incoming updates - you can include your application logic here onMessage: message => console.log('Received:', message.toUtf8()), onError: error => console.error('Subscription error:', error), onClose: () => console.log('Subscription closed.'), }) console.log('Listening for GSOC updates...') // Call subscription.cancel() when you are done listening } listen() ``` ### Subscription Options `gsocSubscribe()` accepts an optional fourth argument that changes what each message contains. It requires Bee 2.8.3 or later. - `fields`: the SOC fields to include in each message, concatenated in the given order. The available fields are `address`, `recoveredPubKey`, `identifier`, `signature`, `wrappedAddress`, `span` and `payload`. The payload has a variable length, so put `payload` last. - `cacheWrappedChunk`: when `true`, the node caches each message's wrapped chunk, so it can be read through the bytes endpoint, for example with `bee.data.download(wrappedAddress)`. ```js const subscription = bee.messaging.gsocSubscribe( signer.publicKey().address(), identifier, { onMessage: message => console.log('Received:', message.toHex()), onError: error => console.error('Subscription error:', error), onClose: () => console.log('Subscription closed.'), }, { fields: ['wrappedAddress', 'payload'], cacheWrappedChunk: true }, ) ``` ## Send a Message (Sender Node) The sending node must have a ***usable postage batch ID*** and also know the ***target overlay address*** and ***identifier*** in order to send a message: ```js const bee = new Bee('http://localhost:1643') // The identifier is initialized using the same data as the receiving node const identifier = NULL_IDENTIFIER const batchId = '6c84b6d3f5273b969c3df875cde7ccd9920f5580122929aedaf440bfe4484405' const recipientOverlay = '1e2054bec3e681aeb0b365a1f9a574a03782176bd3ec0bcf810ebcaf551e4070' async function sendMessage() { // The signer is initialized using the overlay address and identifier shared by the receiving node const signer = bee.messaging.gsocMine(recipientOverlay, identifier) // bee.messaging.gsocSend() is called with the batch id, initialized signer, identifier, and message payload in order to send a GSOC message await bee.messaging.gsocSend(batchId, signer, identifier, 'Hello via GSOC!') console.log('Message sent') } sendMessage() ``` For more information about GSOC, refer to the [Bee documentation](https://docs.ethswarm.org/docs/develop/tools-and-features/gsoc). --- ## Manifests ## 🚧 Under Construction 🚧 :::caution 🚧 This page is under construction This section is still being worked on. Check back soon for updates! ::: * Intro on what Manifests (a.k.a Mantaray nodes) are * Show an example of loading manifests Gist * Show an example of working with loaded manifests * Show creating a manifest from zero, working with it, saving --- ## Migrating from v12 to v13 Version 13 reorganizes the `bee-js` surface. The `Bee` class had grown to well over a hundred methods, so they are now grouped into namespaces by subject, and the Swarm primitives that need no network access were moved into a separate package. Almost nothing was removed in the process. Every v12 method but one has a v13 equivalent, and the renames can be rewritten automatically. ## Run the codemod A codemod ships with the library. It reads your project's types to work out which variables hold a `Bee` instance, then rewrites the call sites in place: ```sh npx bee-js-codemod ./src --from v12 ``` Requirements and behavior: - `typescript` 5.x must be installed in your project, since the codemod uses the TypeScript compiler API to resolve types. TypeScript 7 removed that API and is not supported. - It rewrites `.ts`, `.tsx`, `.js` and `.jsx` files, skipping `node_modules`, `dist` and `.git`. - It edits files in place, so commit or stash your work first. - The target can be a directory or a single file. It handles the method renames below, the `MerkleTree` rename, the `@upcoming/swarm-core` import path, and `jest.spyOn` calls that reference method names as strings. It cannot see through dynamic property access such as `bee[methodName]()`, so check for those by hand. ## What changed ### Methods moved into namespaces `bee.uploadData` is now `bee.data.upload`, `bee.getAllPostageBatch` is now `bee.stamp.getAll`, and so on. See the [full mapping](#full-mapping) below. A few methods stayed directly on `bee` because they do not belong to any one subject: `makeContentAddressedChunk`, `unmarshalContentAddressedChunk`, `makeSingleOwnerChunk`, `unmarshalSingleOwnerChunk`, `calculateSingleOwnerChunkAddress`, `createEnvelope` and `rchash`. ### Swarm primitives moved to `@ethersphere/core-sdk` The byte wrappers, chunk construction, the Mantaray trie, erasure coding, encryption and postage stamp signing now live in [`@ethersphere/core-sdk`](https://www.npmjs.com/package/@ethersphere/core-sdk), which performs no network I/O. `bee-js` depends on it and re-exports everything you are likely to need, so existing imports keep working: ```js ``` Install `core-sdk` directly when you want the primitives without the HTTP client, for example in a worker or on a server that never contacts a Bee node. If you were using the `@upcoming/swarm-core` prerelease, the package is now `@ethersphere/core-sdk`. The codemod rewrites that import path. ### `MerkleTree` is now `ChunkSplitter` `MerkleTree` was renamed to `ChunkSplitter`, and `ChunkBuilder.hash()` returns a `Reference` instead of a `Uint8Array`. The codemod renames the class and appends `.toUint8Array()` to `hash()` calls so the result type stays the same. `ChunkJoiner` is the counterpart that reassembles a chunk tree back into bytes. ### `bee.stamp` and `bee.storage` Postage batch operations are split across two namespaces. `bee.stamp` is the low-level view, taking an amount and a depth. `bee.storage` is the ergonomic view, taking a `Size` and a `Duration`. The old `createPostageBatch` maps to `bee.stamp.create`, and the old `buyStorage` maps to `bee.storage.buy`. ### `waitForUsablePostageStamp` is gone `bee.waitForUsablePostageStamp(batchId)` is the one v12 method with no direct v13 replacement, and the codemod cannot rewrite it. It is no longer needed in most cases: `bee.stamp.create` and `bee.storage.buy` wait for the new batch to become usable before resolving, and you can opt out with `waitForUsable: false` or change the deadline with `waitForUsableTimeout`. Aside from that one method, the codemod covers every public method the `Bee` class had in v12. ## Also worth checking These are not v13 changes, but they are easy to miss when upgrading from older code or from examples written against earlier versions. ### PSS and GSOC handlers require `onClose` Since v10, the handler object passed to `bee.messaging.pssSubscribe` and `bee.messaging.gsocSubscribe` must provide all three callbacks. A handler without `onClose` throws `Expected function for onClose, got: undefined` before the subscription is opened: ```js const subscription = bee.messaging.pssSubscribe(topic, { onMessage: message => console.log(message.toUtf8()), onError: error => console.error(error), onClose: () => console.log('subscription closed'), }) ``` This is not something the codemod can fill in for you, since only you know what closing should do. ### Ambiguous feed methods are deprecated `FeedWriter.upload()` and `FeedReader.download()` still work, but it is ambiguous whether the value being written or read is a payload or a reference. Use the explicit pairs instead: | Deprecated | Use instead | | --- | --- | | `writer.upload(batchId, value)` | `writer.uploadReference(batchId, reference)` or `writer.uploadPayload(batchId, payload)` | | `reader.download()` | `reader.downloadReference()` or `reader.downloadPayload()` | ## Full mapping ### `bee.data` | v12 | v13 | | --- | --- | | `bee.downloadData` | `bee.data.download` | | `bee.downloadReadableData` | `bee.data.downloadReadable` | | `bee.isReferenceRetrievable` | `bee.data.isRetrievable` | | `bee.probeData` | `bee.data.probe` | | `bee.uploadData` | `bee.data.upload` | ### `bee.file` | v12 | v13 | | --- | --- | | `bee.downloadFile` | `bee.file.download` | | `bee.downloadReadableFile` | `bee.file.downloadReadable` | | `bee.uploadFile` | `bee.file.upload` | ### `bee.collection` | v12 | v13 | | --- | --- | | `bee.hashDirectory` | `bee.collection.hashDirectory` | | `bee.streamFiles` | `bee.collection.stream` | | `bee.streamDirectory` | `bee.collection.streamFromDirectory` | | `bee.uploadCollection` | `bee.collection.upload` | | `bee.uploadFilesFromDirectory` | `bee.collection.uploadFromDirectory` | | `bee.uploadFiles` | `bee.collection.uploadFromFileList` | ### `bee.chunk` | v12 | v13 | | --- | --- | | `bee.downloadChunk` | `bee.chunk.download` | | `bee.uploadChunk` | `bee.chunk.upload` | ### `bee.feed` | v12 | v13 | | --- | --- | | `bee.createFeedManifest` | `bee.feed.createManifest` | | `bee.fetchLatestFeedUpdate` | `bee.feed.fetchLatestUpdate` | | `bee.isFeedRetrievable` | `bee.feed.isRetrievable` | | `bee.makeFeedReader` | `bee.feed.makeReader` | | `bee.makeFeedWriter` | `bee.feed.makeWriter` | ### `bee.soc` | v12 | v13 | | --- | --- | | `bee.makeSOCReader` | `bee.soc.makeReader` | | `bee.makeSOCWriter` | `bee.soc.makeWriter` | ### `bee.messaging` | v12 | v13 | | --- | --- | | `bee.gsocMine` | `bee.messaging.gsocMine` | | `bee.gsocSend` | `bee.messaging.gsocSend` | | `bee.gsocSubscribe` | `bee.messaging.gsocSubscribe` | | `bee.pssReceive` | `bee.messaging.pssReceive` | | `bee.pssSend` | `bee.messaging.pssSend` | | `bee.pssSubscribe` | `bee.messaging.pssSubscribe` | ### `bee.stamp` | v12 | v13 | | --- | --- | | `bee.calculateTopUpForBzz` | `bee.stamp.calculateTopUpForBZZ` | | `bee.createPostageBatch` | `bee.stamp.create` | | `bee.diluteBatch` | `bee.stamp.dilute` | | `bee.getPostageBatch` | `bee.stamp.get` | | `bee.getAllPostageBatch` | `bee.stamp.getAll` | | `bee.getPostageBatches` | `bee.stamp.getAll` | | `bee.getAllGlobalPostageBatch` | `bee.stamp.getAllGlobal` | | `bee.getGlobalPostageBatches` | `bee.stamp.getAllGlobal` | | `bee.getPostageBatchBuckets` | `bee.stamp.getBuckets` | | `bee.getGlobalPostageBatch` | `bee.stamp.getGlobal` | | `bee.topUpBatch` | `bee.stamp.topUp` | | `bee.updatePostageBatchLabel` | `bee.stamp.updateLabel` | ### `bee.storage` | v12 | v13 | | --- | --- | | `bee.buyStorage` | `bee.storage.buy` | | `bee.extendStorage` | `bee.storage.extend` | | `bee.extendStorageDuration` | `bee.storage.extendDuration` | | `bee.extendStorageSize` | `bee.storage.extendSize` | | `bee.getStorageCost` | `bee.storage.getCost` | | `bee.getDurationExtensionCost` | `bee.storage.getDurationExtensionCost` | | `bee.getExtensionCost` | `bee.storage.getExtensionCost` | | `bee.getSizeExtensionCost` | `bee.storage.getSizeExtensionCost` | | `bee.renameStorage` | `bee.storage.rename` | ### `bee.tag` | v12 | v13 | | --- | --- | | `bee.createTag` | `bee.tag.create` | | `bee.deleteTag` | `bee.tag.delete` | | `bee.retrieveTag` | `bee.tag.get` | | `bee.getAllTags` | `bee.tag.getAll` | | `bee.updateTag` | `bee.tag.update` | ### `bee.pin` | v12 | v13 | | --- | --- | | `bee.pin` | `bee.pin.add` | | `bee.getPin` | `bee.pin.get` | | `bee.getAllPins` | `bee.pin.getAll` | | `bee.unpin` | `bee.pin.remove` | | `bee.reuploadPinnedData` | `bee.pin.reuploadData` | ### `bee.grantee` | v12 | v13 | | --- | --- | | `bee.createGrantees` | `bee.grantee.create` | | `bee.getGrantees` | `bee.grantee.get` | | `bee.patchGrantees` | `bee.grantee.patch` | ### `bee.stake` | v12 | v13 | | --- | --- | | `bee.depositStake` | `bee.stake.deposit` | | `bee.getStake` | `bee.stake.get` | | `bee.getRedistributionState` | `bee.stake.getRedistributionState` | | `bee.getWithdrawableStake` | `bee.stake.getWithdrawable` | | `bee.migrateStake` | `bee.stake.migrate` | | `bee.withdrawSurplusStake` | `bee.stake.withdrawSurplus` | ### `bee.status` | v12 | v13 | | --- | --- | | `bee.getStatus` | `bee.status.get` | | `bee.getChainState` | `bee.status.getChainState` | | `bee.getHealth` | `bee.status.getHealth` | | `bee.getNodeInfo` | `bee.status.getNodeInfo` | | `bee.getReadiness` | `bee.status.getReadiness` | | `bee.getReserveState` | `bee.status.getReserveState` | | `bee.getVersions` | `bee.status.getVersions` | | `bee.isSupportedApiVersion` | `bee.status.isSupportedApiVersion` | | `bee.isSupportedExactVersion` | `bee.status.isSupportedExactVersion` | ### `bee.connectivity` | v12 | v13 | | --- | --- | | `bee.checkConnection` | `bee.connectivity.checkConnection` | | `bee.getBlocklist` | `bee.connectivity.getBlocklist` | | `bee.getNodeAddresses` | `bee.connectivity.getNodeAddresses` | | `bee.getPeers` | `bee.connectivity.getPeers` | | `bee.getTopology` | `bee.connectivity.getTopology` | | `bee.isConnected` | `bee.connectivity.isConnected` | | `bee.isGateway` | `bee.connectivity.isGateway` | | `bee.pingPeer` | `bee.connectivity.ping` | | `bee.removePeer` | `bee.connectivity.removePeer` | ### `bee.wallet` | v12 | v13 | | --- | --- | | `bee.getWalletBalance` | `bee.wallet.getBalance` | | `bee.withdrawBZZToExternalWallet` | `bee.wallet.withdrawBZZ` | | `bee.withdrawDAIToExternalWallet` | `bee.wallet.withdrawDAI` | ### `bee.chequebook` | v12 | v13 | | --- | --- | | `bee.depositBZZToChequebook` | `bee.chequebook.deposit` | | `bee.depositTokens` | `bee.chequebook.deposit` | | `bee.getChequebookAddress` | `bee.chequebook.getAddress` | | `bee.getChequebookBalance` | `bee.chequebook.getBalance` | | `bee.withdrawBZZFromChequebook` | `bee.chequebook.withdraw` | | `bee.withdrawTokens` | `bee.chequebook.withdraw` | ### `bee.cheque` | v12 | v13 | | --- | --- | | `bee.cashoutLastCheque` | `bee.cheque.cashoutLast` | | `bee.getLastCheques` | `bee.cheque.getAllLatest` | | `bee.getLastChequesForPeer` | `bee.cheque.getAllLatestForPeer` | | `bee.getLastCashoutAction` | `bee.cheque.getLastCashoutAction` | ### `bee.balance` | v12 | v13 | | --- | --- | | `bee.getAllBalances` | `bee.balance.getAll` | | `bee.getPastDueConsumptionBalances` | `bee.balance.getAllPastDueConsumption` | | `bee.getPastDueConsumptionPeerBalance` | `bee.balance.getAllPastDueConsumptionForPeer` | | `bee.getPeerBalance` | `bee.balance.getPeer` | ### `bee.settlement` | v12 | v13 | | --- | --- | | `bee.getSettlements` | `bee.settlement.get` | | `bee.getAllSettlements` | `bee.settlement.getAll` | ### `bee.transaction` | v12 | v13 | | --- | --- | | `bee.cancelPendingTransaction` | `bee.transaction.cancel` | | `bee.getPendingTransaction` | `bee.transaction.get` | | `bee.getAllPendingTransactions` | `bee.transaction.getAll` | | `bee.rebroadcastPendingTransaction` | `bee.transaction.rebroadcast` | ## After migrating - Run your type checker. Argument order and types are unchanged for every renamed method, so a clean type check is a strong signal the migration is complete. - Search for remaining bare method names in strings, dynamic property access, and comments. The codemod resolves types, not string keys other than `jest.spyOn`. - Add `onClose` to every PSS and GSOC handler. --- ## SDK Overview This page serves as a complete reference to all publicly available classes, methods, types, and utilities provided by the `bee-js` SDK. After getting started, this is the place to explore everything you can do with `bee-js` and revisit whenever you need a reminder of how a function works or what a type represents. ### The two packages `bee-js` is split across two packages: | Package | Contents | | ------- | -------- | | [`@ethersphere/bee-js`](https://www.npmjs.com/package/@ethersphere/bee-js) | The `Bee` client and everything that talks to a Bee node over HTTP. | | [`@ethersphere/core-sdk`](https://www.npmjs.com/package/@ethersphere/core-sdk) | The Swarm primitives with no network access: byte wrappers, chunks, Mantaray, erasure coding, encryption and stamp signing. | Everything `core-sdk` exports that you are likely to need is re-exported by `bee-js`, so a single import is usually enough: ```js ``` Install `core-sdk` directly when you want the primitives without the HTTP client, for example when hashing or signing chunks in a worker or on a server that never contacts a Bee node: ```sh npm install @ethersphere/core-sdk ``` ### Namespaces Operations on the `Bee` class are grouped into namespaces by subject. Instead of one flat list of methods, you reach `bee.data.upload(...)`, `bee.stamp.getAll(...)`, `bee.feed.makeWriter(...)` and so on. | Namespace | Purpose | | --------- | ------- | | [`bee.data`](../api/classes/Data.md) | Raw data uploads and downloads, backed by `/bytes`. | | [`bee.file`](../api/classes/File.md) | Single-file uploads and downloads, backed by `/bzz`. | | [`bee.collection`](../api/classes/Collection.md) | Multi-file (directory) uploads, backed by `/bzz`. | | [`bee.chunk`](../api/classes/Chunk.md) | Individual chunk uploads and downloads, backed by `/chunks`. | | [`bee.feed`](../api/classes/Feed.md) | Feed readers, writers and manifests. | | [`bee.rollingFeed`](../api/classes/RollingFeed.md) | Rolling feed readers and writers. | | [`bee.soc`](../api/classes/Soc.md) | Single owner chunk readers and writers. | | [`bee.messaging`](../api/classes/Messaging.md) | PSS and GSOC messaging. | | [`bee.stamp`](../api/classes/Stamp.md) | Postage batches expressed in amount and depth. | | [`bee.storage`](../api/classes/Storage.md) | Postage batches expressed in size and duration. | | [`bee.tag`](../api/classes/Tag.md) | Tags for tracking upload progress. | | [`bee.pin`](../api/classes/Pin.md) | Local pinning and reuploading. | | [`bee.grantee`](../api/classes/Grantee.md) | Access control (ACT) grantee lists. | | [`bee.stake`](../api/classes/Stake.md) | Staking and the redistribution game. | | [`bee.status`](../api/classes/Status.md) | Node health, version, chain and reserve state. | | [`bee.connectivity`](../api/classes/Connectivity.md) | Peers, topology and node addresses. | | [`bee.wallet`](../api/classes/Wallet.md) | Node wallet balances and external withdrawals. | | [`bee.chequebook`](../api/classes/Chequebook.md) | Chequebook address, balance, deposits and withdrawals. | | [`bee.cheque`](../api/classes/Cheque.md) | Cheques and cashouts. | | [`bee.balance`](../api/classes/Balance.md) | SWAP balances with peers. | | [`bee.settlement`](../api/classes/Settlement.md) | SWAP settlements with peers. | | [`bee.transaction`](../api/classes/Transaction.md) | The node's pending transaction queue. | A handful of methods stay directly on `bee` because they do not belong to any one subject: `makeContentAddressedChunk`, `unmarshalContentAddressedChunk`, `makeSingleOwnerChunk`, `unmarshalSingleOwnerChunk`, `calculateSingleOwnerChunkAddress`, `createEnvelope` and `rchash`. :::tip Migrating from v12 or earlier Earlier versions exposed every method directly on `bee`, for example `bee.uploadData` and `bee.getAllPostageBatch`. Those are now `bee.data.upload` and `bee.stamp.getAll`. A codemod ships with the library and rewrites the call sites for you. See [Migrating from v12 to v13](./migrating-to-v13.md) for the full mapping and the other breaking changes. ::: ### Type interfaces `NumberString` is a branded type for marking strings that represent numbers. It interops with `string` and `bigint` types. Where `NumberString` is present, `number` is disallowed in order to avoid pitfalls with unsafe large values. ### Byte primitives All the classes below extend `Bytes`, therefore the following methods are available on all of them: `toUint8Array`, `toHex`, `toBase64`, `toBase32`, `toUtf8`, `parsePayloadAsJson`, `static keccak256`, `static fromUtf8`. The `toString` method uses `toHex`. `Bytes` and its subclasses may be constructed with `new` from `Uint8Array` or hex `string`. #### Elliptic | Name | Description | Methods | | ---------- | ------------------------- | ------------------------------------------------------ | | PrivateKey | 32 bytes private key | `publicKey`, `sign` | | PublicKey | 64 bytes public key | `address`, `toCompressedUint8Array`, `toCompressedHex` | | EthAddress | 20 bytes Ethereum address | `toChecksum` | | Signature | 65 bytes signature | `recoverPublicKey` | #### Swarm | Name | Description | Methods | | ------------- | ----------------------------------- | ------------------------------- | | Reference | 32/64 bytes reference (chunk, feed) | `toCid` | | Identifier | 32 bytes identifier (SOC, Feed) | - | | TransactionId | 32 bytes transaction ID | - | | FeedIndex | 8 bytes feed index (BE) | `static fromBigInt`, `toBigInt` | | Topic | 32 bytes topic | `static fromString` | | PeerAddress | 32 bytes peer address | - | | BatchId | 32 bytes batch ID | - | | Span | 8 bytes span (LE) | `static fromBigInt`, `toBigInt` | ### Tokens | Name | Description | Construction | Conversion | Arithmetic and comparison | | ---- | --------------------------- | ------------------------------------------------------------------- | -------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- | | DAI | ERC20 DAI token (18 digits) | `static fromDecimalString`, `static fromWei`, `static fromFloat` | `toWeiString`, `toWeiBigInt`, `toDecimalString`, `toFloat`, `toSignificantDigits`, `exchangeToBZZ` | `plus`, `minus`, `divide`, `gt`, `gte`, `lt`, `lte`, `eq` | | BZZ | ERC20 BZZ token (16 digits) | `static fromDecimalString`, `static fromPLUR`, `static fromFloat` | `toPLURString`, `toPLURBigInt`, `toDecimalString`, `toFloat`, `toSignificantDigits`, `exchangeToDAI` | `plus`, `minus`, `divide`, `gt`, `gte`, `lt`, `lte`, `eq` | Both are created through static factories, so they are called without `new`: `BZZ.fromDecimalString('1')`. Instances are immutable, and the arithmetic methods return a new instance rather than mutating the receiver. ### Units | Name | Description | Methods | | -------- | ------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------- | | Size | A size in bytes | `static fromBytes`, `static fromKilobytes`, `static fromMegabytes`, `static fromGigabytes`, `static parseFromString`, `toBytes`, `toGigabytes`, `toFormattedString` | | Duration | A span of time | `static fromSeconds`, `static fromHours`, `static fromDays`, `static fromWeeks`, `static fromYears`, `static fromEndDate`, `static parseFromString`, `toSeconds`, `toHours`, `toDays` | Both use 1000 rather than 1024 as the base for unit conversions, matching the Swarm papers on theoretical and effective storage capacity. ### Swarm chunks | Name | Description | Creation | | ---------------- | ----------------------------------------------------------------------------------------------- | --------------------------- | | Chunk | Span, max. 4096 bytes payload; address derived from content | `makeContentAddressedChunk` | | SingleOwnerChunk | Identifier, signature, span, max. 4096 bytes payload; address derived from identifier and owner | `makeSingleOwnerChunk` | ### Swarm primitives | Name | Description | Methods | | ------------- | ---------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------- | | MantarayNode | Compact trie with reference values and JSON metadata | `addFork`, `removeFork`, `calculateSelfAddress`, `find`, `findClosest`, `collect`, `marshal`, `unmarshal`, `saveRecursively`, `loadRecursively` | | ChunkSplitter | Streaming BMT that turns a byte stream into chunks | `append`, `finalize`, `static root`, `static encryptedRoot` | | ChunkBuilder | A single chunk under construction | `build`, `hash`, `encryptedHash` | | ChunkJoiner | Reassembles a chunk tree back into bytes | `join`, `static collect`, `static collectEncrypted` | | Stamper | Signs postage stamps locally | `stamp`, `getState`, `static fromBlank`, `static fromState` | :::note `MerkleTree` was renamed `MerkleTree` is now `ChunkSplitter`, and `ChunkBuilder.hash()` returns a `Reference` rather than a `Uint8Array`. The [codemod](./migrating-to-v13.md) handles both changes. ::: ### Swarm objects | Name | Description | Creation | | ---------- | ----------------------- | --------------------- | | SOCWriter | SingleOwnerChunk writer | `bee.soc.makeWriter` | | SOCReader | SingleOwnerChunk reader | `bee.soc.makeReader` | | FeedWriter | Feed writer | `bee.feed.makeWriter` | | FeedReader | Feed reader | `bee.feed.makeReader` | ### Bee API Every `bee-js` method that talks to a node is listed below with the endpoint it calls and the least capable [node type](https://docs.ethswarm.org/docs/bee/working-with-bee/node-types) that can serve it. The tables are grouped by namespace. Most methods call a single endpoint; the few that compose several list each one. Methods that run entirely locally are listed [at the end](#methods-that-make-no-request). Refer to the [Bee API specifications](https://docs.ethswarm.org/api/) for the details of each endpoint. The node mode column reads as a minimum, so a more capable node also serves the endpoint: - **Ultra-light** — any node, whether ultra-light, light or full. - **Light** — a light node or a full node. - **Full** — a full node only. #### `bee.data` | Method | Bee endpoint | Node mode | | --- | --- | --- | | `data.upload` | `POST /bytes` [🔗](https://docs.ethswarm.org/api/#tag/Bytes/paths/~1bytes/post) | Light | | `data.download` | `GET /bytes/:reference` [🔗](https://docs.ethswarm.org/api/#tag/Bytes/paths/~1bytes~1%7Breference%7D/get) | Ultra-light | | `data.downloadReadable` | `GET /bytes/:reference` [🔗](https://docs.ethswarm.org/api/#tag/Bytes/paths/~1bytes~1%7Breference%7D/get) | Ultra-light | | `data.probe` | `HEAD /bytes/:reference` [🔗](https://docs.ethswarm.org/api/#tag/Bytes/paths/~1bytes~1%7Breference%7D/head) | Ultra-light | | `data.isRetrievable` | `GET /stewardship/:reference` [🔗](https://docs.ethswarm.org/api/#tag/Stewardship/paths/~1stewardship~1%7Breference%7D/get) | Ultra-light | #### `bee.file` | Method | Bee endpoint | Node mode | | --- | --- | --- | | `file.upload` | `POST /bzz` [🔗](https://docs.ethswarm.org/api/#tag/BZZ/paths/~1bzz/post) | Light | | `file.download` | `GET /bzz/:reference` [🔗](https://docs.ethswarm.org/api/#tag/BZZ/paths/~1bzz~1%7Breference%7D/get) | Ultra-light | | `file.download` _with path_ | `GET /bzz/:reference/:path` [🔗](https://docs.ethswarm.org/api/#tag/BZZ/paths/~1bzz~1%7Breference%7D~1%7Bpath%7D/get) | Ultra-light | | `file.downloadReadable` | `GET /bzz/:reference` [🔗](https://docs.ethswarm.org/api/#tag/BZZ/paths/~1bzz~1%7Breference%7D/get) | Ultra-light | #### `bee.collection` | Method | Bee endpoint | Node mode | | --- | --- | --- | | `collection.upload` | `POST /bzz` [🔗](https://docs.ethswarm.org/api/#tag/BZZ/paths/~1bzz/post) | Light | | `collection.uploadFromDirectory` _Node.js_ | `POST /bzz` [🔗](https://docs.ethswarm.org/api/#tag/BZZ/paths/~1bzz/post) | Light | | `collection.uploadFromFileList` _Browser_ | `POST /bzz` [🔗](https://docs.ethswarm.org/api/#tag/BZZ/paths/~1bzz/post) | Light | | `collection.streamFromDirectory` _Node.js_ | `POST /chunks` [🔗](https://docs.ethswarm.org/api/#tag/Chunk/paths/~1chunks/post) | Light | | `collection.stream` _Browser_ | `POST /chunks` [🔗](https://docs.ethswarm.org/api/#tag/Chunk/paths/~1chunks/post) | Light | #### `bee.chunk` | Method | Bee endpoint | Node mode | | --- | --- | --- | | `chunk.upload` | `POST /chunks` [🔗](https://docs.ethswarm.org/api/#tag/Chunk/paths/~1chunks/post) | Light | | `chunk.download` | `GET /chunks/:reference` [🔗](https://docs.ethswarm.org/api/#tag/Chunk/paths/~1chunks~1%7Baddress%7D/get) | Ultra-light | #### `bee.feed` | Method | Bee endpoint | Node mode | | --- | --- | --- | | `feed.createManifest` | `POST /feeds/:owner/:topic` [🔗](https://docs.ethswarm.org/api/#tag/Feed/paths/~1feeds~1%7Bowner%7D~1%7Btopic%7D/post) | Light | | `FeedReader.downloadReference` / `downloadPayload` | `GET /feeds/:owner/:topic` [🔗](https://docs.ethswarm.org/api/#tag/Feed/paths/~1feeds~1%7Bowner%7D~1%7Btopic%7D/get) | Ultra-light | | `FeedWriter.uploadReference` / `uploadPayload` | `POST /soc/:owner/:identifier` [🔗](https://docs.ethswarm.org/api/#tag/Single-owner-chunk/paths/~1soc~1%7Bowner%7D~1%7Bid%7D/post) | Light | | `feed.fetchLatestUpdate` | `GET /feeds/:owner/:topic` [🔗](https://docs.ethswarm.org/api/#tag/Feed/paths/~1feeds~1%7Bowner%7D~1%7Btopic%7D/get) | Ultra-light | | `feed.isRetrievable` | `GET /feeds/:owner/:topic` [🔗](https://docs.ethswarm.org/api/#tag/Feed/paths/~1feeds~1%7Bowner%7D~1%7Btopic%7D/get), or `GET /chunks/:reference` [🔗](https://docs.ethswarm.org/api/#tag/Chunk/paths/~1chunks~1%7Baddress%7D/get) once per index when given an `index` | Ultra-light | #### `bee.rollingFeed` | Method | Bee endpoint | Node mode | | --- | --- | --- | | `RollingFeedReader.downloadReference` / `downloadPayload` | `GET /feeds/:owner/:topic` [🔗](https://docs.ethswarm.org/api/#tag/Feed/paths/~1feeds~1%7Bowner%7D~1%7Btopic%7D/get) | Ultra-light | | `RollingFeedWriter.uploadReference` / `uploadPayload` | `POST /soc/:owner/:identifier` [🔗](https://docs.ethswarm.org/api/#tag/Single-owner-chunk/paths/~1soc~1%7Bowner%7D~1%7Bid%7D/post) | Light | | `RollingFeedWriter.isCaughtUp` | `GET /feeds/:owner/:topic` [🔗](https://docs.ethswarm.org/api/#tag/Feed/paths/~1feeds~1%7Bowner%7D~1%7Btopic%7D/get) | Ultra-light | | `RollingFeedWriter.catchUp` | `GET /feeds/:owner/:topic` [🔗](https://docs.ethswarm.org/api/#tag/Feed/paths/~1feeds~1%7Bowner%7D~1%7Btopic%7D/get), `GET /chunks/:reference` [🔗](https://docs.ethswarm.org/api/#tag/Chunk/paths/~1chunks~1%7Baddress%7D/get) and `POST /soc/:owner/:identifier` [🔗](https://docs.ethswarm.org/api/#tag/Single-owner-chunk/paths/~1soc~1%7Bowner%7D~1%7Bid%7D/post) | Light | #### `bee.soc` | Method | Bee endpoint | Node mode | | --- | --- | --- | | `SOCWriter.upload` | `POST /soc/:owner/:identifier` [🔗](https://docs.ethswarm.org/api/#tag/Single-owner-chunk/paths/~1soc~1%7Bowner%7D~1%7Bid%7D/post) | Light | | `SOCReader.download` | `GET /chunks/:reference` [🔗](https://docs.ethswarm.org/api/#tag/Chunk/paths/~1chunks~1%7Baddress%7D/get) | Ultra-light | #### `bee.messaging` | Method | Bee endpoint | Node mode | | --- | --- | --- | | `messaging.pssSend` | `POST /pss/send/:topic/:target` [🔗](https://docs.ethswarm.org/api/#tag/Postal-Service-for-Swarm/paths/~1pss~1send~1%7Btopic%7D~1%7Btargets%7D/post) | Light | | `messaging.pssSubscribe` _Websocket_ | `GET /pss/subscribe/:topic` [🔗](https://docs.ethswarm.org/api/#tag/Postal-Service-for-Swarm/paths/~1pss~1subscribe~1%7Btopic%7D/get) | Full | | `messaging.pssReceive` | `GET /pss/subscribe/:topic` [🔗](https://docs.ethswarm.org/api/#tag/Postal-Service-for-Swarm/paths/~1pss~1subscribe~1%7Btopic%7D/get) | Full | | `messaging.gsocSend` | `POST /soc/:owner/:identifier` [🔗](https://docs.ethswarm.org/api/#tag/Single-owner-chunk/paths/~1soc~1%7Bowner%7D~1%7Bid%7D/post) | Light | | `messaging.gsocSubscribe` _Websocket_ | `GET /gsoc/subscribe/:address` | Full | #### `bee.stamp` | Method | Bee endpoint | Node mode | | --- | --- | --- | | `stamp.create` | `POST /stamps/:amount/:depth` [🔗](https://docs.ethswarm.org/api/#tag/Postage-Stamps/paths/~1stamps~1%7Bamount%7D~1%7Bdepth%7D/post) | Light | | `stamp.get` | `GET /stamps/:batchId` [🔗](https://docs.ethswarm.org/api/#tag/Postage-Stamps/paths/~1stamps~1%7Bbatch_id%7D/get) | Light | | `stamp.getAll` | `GET /stamps` [🔗](https://docs.ethswarm.org/api/#tag/Postage-Stamps/paths/~1stamps/get) | Light | | `stamp.getBuckets` | `GET /stamps/:batchId/buckets` [🔗](https://docs.ethswarm.org/api/#tag/Postage-Stamps/paths/~1stamps~1%7Bbatch_id%7D~1buckets/get) | Light | | `stamp.getGlobal` | `GET /batches/:batchId` [🔗](https://docs.ethswarm.org/api/#tag/Postage-Stamps/paths/~1batches/get) | Light | | `stamp.getAllGlobal` | `GET /batches` [🔗](https://docs.ethswarm.org/api/#tag/Postage-Stamps/paths/~1batches/get) | Light | | `stamp.topUp` | `PATCH /stamps/topup/:batchId/:amount` [🔗](https://docs.ethswarm.org/api/#tag/Postage-Stamps/paths/~1stamps~1topup~1%7Bbatch_id%7D~1%7Bamount%7D/patch) | Light | | `stamp.dilute` | `PATCH /stamps/dilute/:batchId/:depth` [🔗](https://docs.ethswarm.org/api/#tag/Postage-Stamps/paths/~1stamps~1dilute~1%7Bbatch_id%7D~1%7Bdepth%7D/patch) | Light | | `stamp.updateLabel` | `PATCH /stamps/:batchId` [🔗](https://docs.ethswarm.org/api/#tag/Postage-Stamps/paths/~1stamps~1%7Bbatch_id%7D/patch) | Light | | `stamp.calculateTopUpForBZZ` | `GET /chainstate` [🔗](https://docs.ethswarm.org/api/#tag/Status/paths/~1chainstate/get) | Light | `stamp.create` also reads `GET /chainstate` to check the amount against the current price, and then polls `GET /stamps/:batchId` until the batch is usable, unless you pass `waitForUsable: false`. #### `bee.storage` `bee.storage` is the size and duration view of `bee.stamp`, so every method here also reads `GET /chainstate` to convert a `Size` and `Duration` into the depth and amount the endpoints below take. `storage.extend` and `storage.extendSize` call the top-up endpoint, the dilute endpoint, or both, depending on whether the duration, the size, or both have to grow. | Method | Bee endpoint | Node mode | | --- | --- | --- | | `storage.getCost` | `GET /chainstate` [🔗](https://docs.ethswarm.org/api/#tag/Status/paths/~1chainstate/get) | Light | | `storage.buy` | `POST /stamps/:amount/:depth` [🔗](https://docs.ethswarm.org/api/#tag/Postage-Stamps/paths/~1stamps~1%7Bamount%7D~1%7Bdepth%7D/post) | Light | | `storage.extend` | `PATCH /stamps/topup/:batchId/:amount` [🔗](https://docs.ethswarm.org/api/#tag/Postage-Stamps/paths/~1stamps~1topup~1%7Bbatch_id%7D~1%7Bamount%7D/patch), `PATCH /stamps/dilute/:batchId/:depth` [🔗](https://docs.ethswarm.org/api/#tag/Postage-Stamps/paths/~1stamps~1dilute~1%7Bbatch_id%7D~1%7Bdepth%7D/patch) | Light | | `storage.extendSize` | `PATCH /stamps/topup/:batchId/:amount` [🔗](https://docs.ethswarm.org/api/#tag/Postage-Stamps/paths/~1stamps~1topup~1%7Bbatch_id%7D~1%7Bamount%7D/patch), `PATCH /stamps/dilute/:batchId/:depth` [🔗](https://docs.ethswarm.org/api/#tag/Postage-Stamps/paths/~1stamps~1dilute~1%7Bbatch_id%7D~1%7Bdepth%7D/patch) | Light | | `storage.extendDuration` | `PATCH /stamps/topup/:batchId/:amount` [🔗](https://docs.ethswarm.org/api/#tag/Postage-Stamps/paths/~1stamps~1topup~1%7Bbatch_id%7D~1%7Bamount%7D/patch) | Light | | `storage.getExtensionCost` | `GET /stamps/:batchId` [🔗](https://docs.ethswarm.org/api/#tag/Postage-Stamps/paths/~1stamps~1%7Bbatch_id%7D/get) | Light | | `storage.getSizeExtensionCost` | `GET /stamps/:batchId` [🔗](https://docs.ethswarm.org/api/#tag/Postage-Stamps/paths/~1stamps~1%7Bbatch_id%7D/get) | Light | | `storage.getDurationExtensionCost` | `GET /stamps/:batchId` [🔗](https://docs.ethswarm.org/api/#tag/Postage-Stamps/paths/~1stamps~1%7Bbatch_id%7D/get) | Light | | `storage.rename` | `PATCH /stamps/:batchId` [🔗](https://docs.ethswarm.org/api/#tag/Postage-Stamps/paths/~1stamps~1%7Bbatch_id%7D/patch) | Light | #### `bee.tag` | Method | Bee endpoint | Node mode | | --- | --- | --- | | `tag.create` | `POST /tags` [🔗](https://docs.ethswarm.org/api/#tag/Tag/paths/~1tags/post) | Light | | `tag.get` | `GET /tags/:id` [🔗](https://docs.ethswarm.org/api/#tag/Tag/paths/~1tags~1%7Buid%7D/get) | Light | | `tag.getAll` | `GET /tags` [🔗](https://docs.ethswarm.org/api/#tag/Tag/paths/~1tags/get) | Light | | `tag.update` | `PATCH /tags/:id` [🔗](https://docs.ethswarm.org/api/#tag/Tag/paths/~1tags~1%7Buid%7D/patch) | Light | | `tag.delete` | `DELETE /tags/:id` [🔗](https://docs.ethswarm.org/api/#tag/Tag/paths/~1tags~1%7Buid%7D/delete) | Light | #### `bee.pin` | Method | Bee endpoint | Node mode | | --- | --- | --- | | `pin.add` | `POST /pins/:reference` [🔗](https://docs.ethswarm.org/api/#tag/Pinning/paths/~1pins~1%7Breference%7D/post) | Ultra-light | | `pin.get` | `GET /pins/:reference` [🔗](https://docs.ethswarm.org/api/#tag/Pinning/paths/~1pins~1%7Breference%7D/get) | Ultra-light | | `pin.getAll` | `GET /pins` [🔗](https://docs.ethswarm.org/api/#tag/Pinning/paths/~1pins/get) | Ultra-light | | `pin.remove` | `DELETE /pins/:reference` [🔗](https://docs.ethswarm.org/api/#tag/Pinning/paths/~1pins~1%7Breference%7D/delete) | Ultra-light | | `pin.reuploadData` | `PUT /stewardship/:reference` [🔗](https://docs.ethswarm.org/api/#tag/Stewardship/paths/~1stewardship~1%7Breference%7D/put) | Light | #### `bee.grantee` | Method | Bee endpoint | Node mode | | --- | --- | --- | | `grantee.create` | `POST /grantee` [🔗](https://docs.ethswarm.org/api/#tag/ACT/paths/~1grantee/post) | Light | | `grantee.get` | `GET /grantee/:reference` [🔗](https://docs.ethswarm.org/api/#tag/ACT/paths/~1grantee~1%7Breference%7D/get) | Light | | `grantee.patch` | `PATCH /grantee/:reference` [🔗](https://docs.ethswarm.org/api/#tag/ACT/paths/~1grantee~1%7Breference%7D/patch) | Light | #### `bee.stake` | Method | Bee endpoint | Node mode | | --- | --- | --- | | `stake.deposit` | `POST /stake` [🔗](https://docs.ethswarm.org/api/#tag/Staking/paths/~1stake~1%7Bamount%7D/post) | Full | | `stake.get` | `GET /stake` [🔗](https://docs.ethswarm.org/api/#tag/Staking/paths/~1stake/get) | Full | | `stake.getMinimumDeposit` | `GET /stake` [🔗](https://docs.ethswarm.org/api/#tag/Staking/paths/~1stake/get) | Full | | `stake.getWithdrawable` | `GET /stake/withdrawable` [🔗](https://docs.ethswarm.org/api/#tag/Staking/paths/~1stake~1withdrawable/get) | Full | | `stake.withdrawSurplus` | `DELETE /stake/withdrawable` [🔗](https://docs.ethswarm.org/api/#tag/Staking/paths/~1stake~1withdrawable/delete) | Full | | `stake.migrate` | `DELETE /stake` [🔗](https://docs.ethswarm.org/api/#tag/Staking/paths/~1stake/delete) | Full | | `stake.getRedistributionState` | `GET /redistributionstate` [🔗](https://docs.ethswarm.org/api/#tag/RedistributionState/paths/~1redistributionstate/get) | Full | | `stake.setRedistributionEnabled` | `PATCH /redistributionstate` | Full | #### `bee.status` | Method | Bee endpoint | Node mode | | --- | --- | --- | | `status.getHealth` | `GET /health` [🔗](https://docs.ethswarm.org/api/#tag/Status/paths/~1health/get) | Ultra-light | | `status.getReadiness` | `GET /readiness` [🔗](https://docs.ethswarm.org/api/#tag/Status/paths/~1readiness/get) | Ultra-light | | `status.getNodeInfo` | `GET /node` [🔗](https://docs.ethswarm.org/api/#tag/Status/paths/~1node/get) | Ultra-light | | `status.get` | `GET /status` [🔗](https://docs.ethswarm.org/api/#tag/Node-Status/paths/~1status/get) | Ultra-light | | `status.getChainState` | `GET /chainstate` [🔗](https://docs.ethswarm.org/api/#tag/Status/paths/~1chainstate/get) | Light | | `status.getReserveState` | `GET /reservestate` [🔗](https://docs.ethswarm.org/api/#tag/Status/paths/~1reservestate/get) | Full | | `status.getVersions` | `GET /health` [🔗](https://docs.ethswarm.org/api/#tag/Status/paths/~1health/get) | Ultra-light | | `status.isSupportedApiVersion` | `GET /health` [🔗](https://docs.ethswarm.org/api/#tag/Status/paths/~1health/get) | Ultra-light | | `status.isSupportedExactVersion` | `GET /health` [🔗](https://docs.ethswarm.org/api/#tag/Status/paths/~1health/get) | Ultra-light | #### `bee.connectivity` | Method | Bee endpoint | Node mode | | --- | --- | --- | | `connectivity.isConnected` | `GET /` | Ultra-light | | `connectivity.checkConnection` | `GET /` | Ultra-light | | `connectivity.isGateway` | `GET /gateway` | Ultra-light | | `connectivity.getNodeAddresses` | `GET /addresses` [🔗](https://docs.ethswarm.org/api/#tag/Connectivity/paths/~1addresses/get) | Ultra-light | | `connectivity.getPeers` | `GET /peers` [🔗](https://docs.ethswarm.org/api/#tag/Connectivity/paths/~1peers/get) | Ultra-light | | `connectivity.getBlocklist` | `GET /blocklist` [🔗](https://docs.ethswarm.org/api/#tag/Connectivity/paths/~1blocklist/get) | Ultra-light | | `connectivity.removePeer` | `DELETE /peers/:peer` [🔗](https://docs.ethswarm.org/api/#tag/Connectivity/paths/~1peers~1%7Baddress%7D/delete) | Ultra-light | | `connectivity.ping` | `POST /pingpong/:peer` [🔗](https://docs.ethswarm.org/api/#tag/Connectivity/paths/~1pingpong~1%7Bpeer-id%7D/post) | Ultra-light | | `connectivity.getTopology` | `GET /topology` [🔗](https://docs.ethswarm.org/api/#tag/Connectivity/paths/~1topology/get) | Ultra-light | `GET /gateway` is not part of the Bee API specification. Some gateway tooling exposes it, and `connectivity.isGateway` returns `false` on any node that does not. #### `bee.wallet` | Method | Bee endpoint | Node mode | | --- | --- | --- | | `wallet.getBalance` | `GET /wallet` [🔗](https://docs.ethswarm.org/api/#tag/Wallet/paths/~1wallet/get) | Light | | `wallet.withdrawBZZ` | `POST /wallet/withdraw/bzz` [🔗](https://docs.ethswarm.org/api/#tag/Wallet/paths/~1wallet~1withdraw~1bzz/post) | Light | | `wallet.withdrawDAI` | `POST /wallet/withdraw/nativetoken` [🔗](https://docs.ethswarm.org/api/#tag/Wallet/paths/~1wallet~1withdraw~1nativetoken/post) | Light | #### `bee.chequebook` | Method | Bee endpoint | Node mode | | --- | --- | --- | | `chequebook.getAddress` | `GET /chequebook/address` [🔗](https://docs.ethswarm.org/api/#tag/Chequebook/paths/~1chequebook~1address/get) | Light | | `chequebook.getBalance` | `GET /chequebook/balance` [🔗](https://docs.ethswarm.org/api/#tag/Chequebook/paths/~1chequebook~1balance/get) | Light | | `chequebook.deposit` | `POST /chequebook/deposit` [🔗](https://docs.ethswarm.org/api/#tag/Chequebook/paths/~1chequebook~1deposit/post) | Light | | `chequebook.withdraw` | `POST /chequebook/withdraw` [🔗](https://docs.ethswarm.org/api/#tag/Chequebook/paths/~1chequebook~1withdraw/post) | Light | #### `bee.cheque` | Method | Bee endpoint | Node mode | | --- | --- | --- | | `cheque.getAllLatest` | `GET /chequebook/cheque` [🔗](https://docs.ethswarm.org/api/#tag/Chequebook/paths/~1chequebook~1cheque/get) | Light | | `cheque.getAllLatestForPeer` | `GET /chequebook/cheque/:peer` [🔗](https://docs.ethswarm.org/api/#tag/Chequebook/paths/~1chequebook~1cheque~1%7Bpeer-id%7D/get) | Light | | `cheque.getLastCashoutAction` | `GET /chequebook/cashout/:peer` [🔗](https://docs.ethswarm.org/api/#tag/Chequebook/paths/~1chequebook~1cashout~1%7Bpeer-id%7D/get) | Light | | `cheque.cashoutLast` | `POST /chequebook/cashout/:peer` [🔗](https://docs.ethswarm.org/api/#tag/Chequebook/paths/~1chequebook~1cashout~1%7Bpeer-id%7D/post) | Light | #### `bee.balance` | Method | Bee endpoint | Node mode | | --- | --- | --- | | `balance.getAll` | `GET /balances` [🔗](https://docs.ethswarm.org/api/#tag/Balance/paths/~1balances/get) | Light | | `balance.getPeer` | `GET /balances/:peer` [🔗](https://docs.ethswarm.org/api/#tag/Balance/paths/~1balances~1%7Baddress%7D/get) | Light | | `balance.getAllPastDueConsumption` | `GET /consumed` [🔗](https://docs.ethswarm.org/api/#tag/Balance/paths/~1consumed/get) | Light | | `balance.getAllPastDueConsumptionForPeer` | `GET /consumed/:peer` [🔗](https://docs.ethswarm.org/api/#tag/Balance/paths/~1consumed~1%7Baddress%7D/get) | Light | #### `bee.settlement` | Method | Bee endpoint | Node mode | | --- | --- | --- | | `settlement.getAll` | `GET /settlements` [🔗](https://docs.ethswarm.org/api/#tag/Settlements/paths/~1settlements/get) | Light | | `settlement.get` | `GET /settlements/:peer` [🔗](https://docs.ethswarm.org/api/#tag/Settlements/paths/~1settlements~1%7Baddress%7D/get) | Light | #### `bee.transaction` | Method | Bee endpoint | Node mode | | --- | --- | --- | | `transaction.getAll` | `GET /transactions` [🔗](https://docs.ethswarm.org/api/#tag/Transaction/paths/~1transactions/get) | Light | | `transaction.get` | `GET /transactions/:id` [🔗](https://docs.ethswarm.org/api/#tag/Transaction/paths/~1transactions~1%7BtxHash%7D/get) | Light | | `transaction.rebroadcast` | `POST /transactions/:id` [🔗](https://docs.ethswarm.org/api/#tag/Transaction/paths/~1transactions~1%7BtxHash%7D/post) | Light | | `transaction.cancel` | `DELETE /transactions/:id` [🔗](https://docs.ethswarm.org/api/#tag/Transaction/paths/~1transactions~1%7BtxHash%7D/delete) | Light | #### Directly on `bee` | Method | Bee endpoint | Node mode | | --- | --- | --- | | `createEnvelope` | `POST /envelope/:reference` [🔗](https://docs.ethswarm.org/api/#tag/Envelope/paths/~1envelope~1%7Baddress%7D/post) | Light | | `rchash` | `GET /rchash/:depth/:anchor1/:anchor2` [🔗](https://docs.ethswarm.org/api/#tag/RCHash/paths/~1rchash~1%7Bdepth%7D~1%7Banchor1%7D~1%7Banchor2%7D/get) | Full | #### Methods that make no request The remaining public methods run entirely locally, so no endpoint or node mode applies to them: | Method | What it does | | --- | --- | | `bee.makeContentAddressedChunk` | Builds a content addressed chunk from a payload. | | `bee.unmarshalContentAddressedChunk` | Parses raw bytes back into a content addressed chunk. | | `bee.makeSingleOwnerChunk` | Signs a content addressed chunk into a single owner chunk. | | `bee.unmarshalSingleOwnerChunk` | Parses raw bytes back into a single owner chunk. | | `bee.calculateSingleOwnerChunkAddress` | Derives a SOC address from an identifier and an owner. | | `collection.hashDirectory` | Hashes a local directory to get its Swarm reference without uploading it. | | `feed.makeReader` / `feed.makeWriter` | Construct the `FeedReader` and `FeedWriter` whose own methods are listed above. | | `soc.makeReader` / `soc.makeWriter` | Construct the `SOCReader` and `SOCWriter` whose own methods are listed above. | | `messaging.gsocMine` | Mines the signer whose SOC address falls into the target node's neighborhood. | The `Utils` namespace below is local as well. ### Utils Utilities are exposed under the `Utils` namespace: `import { Utils } from '@ethersphere/bee-js'`. #### General - `getCollectionSize` - `getFolderSize` - `makeCollectionFromFileList` #### PSS - `makeMaxTarget` #### Erasure Coding - `approximateOverheadForRedundancyLevel` - `getRedundancyStat` - `getRedundancyStats` #### Stamps - `getAmountForDuration` - `getDepthForSize` - `getStampCost` - `getStampDuration` - `getStampEffectiveBytes` - `getStampEffectiveBytesBreakpoints` - `getStampTheoreticalBytes` - `getStampUsage` - `convertEnvelopeToMarshaledStamp` - `mapPostageBatch` - `unmapPostageBatch` --- ## Pinning Pinning allows you to guarantee that content will always be available by storing it **locally on your own Bee node**. However, pinning ***does not*** guarantee availability across the Swarm network. Therefore you must use pinning along with the **stewardship utilities** included in `bee-js` to monitor the availability of your pinned content and reupload it if needed. In this section, you'll learn how to: - Pin content - Check whether pinned content is still retrievable from the network - Reupload missing content - View all currently pinned references - Remove pins that are no longer required ## Pinning and Unpinning Content To pin a reference (so it remains stored on your node): ```js await bee.pin.add(reference) console.log('Reference pinned locally.') ``` To stop tracking and remove it from local pin storage: ```js await bee.pin.remove(reference) console.log('Reference unpinned and no longer tracked.') ``` ## Checking if a Reference is Retrievable Use `bee.data.isRetrievable(reference)` to verify if the content for a given Swarm reference is currently accessible on the network: ```js const isAvailable = await bee.data.isRetrievable(reference) if (isAvailable) { console.log('Data is retrievable from the network.') } else { console.log('Data is missing from the network.') } ``` ## Reuploading Pinned Data If content is missing but was previously pinned, you can reupload it using `bee.pin.reuploadData(postageBatchId, reference)`: ```js await bee.pin.reuploadData(postageBatchId, reference) console.log('Data has been reuploaded to the network.') ``` ## Listing All Pinned References You can get all currently pinned references with: ```js const pins = await bee.pin.getAll() console.log('Pinned references:', pins.map(ref => ref.toHex())) ``` To check if a specific reference is pinned: ```js const pinStatus = await bee.pin.get(reference) console.log('Pin info:', pinStatus) ``` ## Example Script The following script automates the process of checking all locally pinned references, verifying their retrievability from the network, and reuploading any that are missing. This ensures that your pinned data remains available even if it has dropped out of the Swarm network. ```js const bee = new Bee('http://localhost:1633') const postageBatchId = "129903062bedc4eca6fc1c232ed385e93dda72f711caa1ead6018334dd801cee" async function reuploadMissingPins() { try { // Get all currently pinned references const pinnedRefs = await bee.pin.getAll() if (!pinnedRefs.length) { console.log("No pinned references found.") return } console.log(`Found ${pinnedRefs.length} pinned references.`) let repaired = 0 // Loop through all references and check retrievability for (const ref of pinnedRefs) { const reference = ref.toHex() const isAvailable = await bee.data.isRetrievable(reference) if (isAvailable) { console.log(`✅ ${reference} is retrievable.`) } else { console.log(`⚠️ ${reference} is missing — reuploading...`) await bee.pin.reuploadData(postageBatchId, reference) console.log(`🔁 Reuploaded ${reference}`) repaired++ } } console.log(`\nDone. ${repaired} reference(s) were reuploaded.`) } catch (error) { console.error("Error:", error.message) } } reuploadMissingPins() ``` Example terminal output: ```bash Found 2 pinned references. ⚠️ 1880ff0bbd23997dfa46921ba2ab0098824d967fe60c6ca1ae2e8fd722f4db78 is missing — reuploading... 🔁 Reuploaded 1880ff0bbd23997dfa46921ba2ab0098824d967fe60c6ca1ae2e8fd722f4db78 ✅ fd79d5e0ebd8407e422f53ce1d7c4c41ebf403be55143900f8d1490560294780 is retrievable. Done. 1 reference(s) were reuploaded. ``` --- ## Postal Service over Swarm Swarm supports sending encrypted messages over the network using a system called **Postal Service over Swarm** (PSS). These messages are embedded in regular Swarm traffic and routed to specific nodes based on their overlay address. ## What Is PSS? PSS provides pub/sub-like functionality for secure messaging. Full nodes can listen for messages on a specific **topic**, and other nodes (light or full) can send them payloads addressed to the recipient node's **overlay address**, optionally encrypted with the recipient's **PSS public key**. Messages can be received via **subscription** or by a **one-off listener**. :::caution Only full nodes can receive messages, since PSS messages are sent as part of the chunk syncing process, which only full nodes take part in. ::: ## Requirements To use the example scripts below, you need: - A Bee full node with a fully synced reserve for receiving PSS messages. - A light node for sending PSS messages. - The batch ID of a usable postage batch. If you don't have one already, you will need to [buy a batch](./buying-storage.md#purchasing-storage) to upload data. If you do have one, you will need to [get and save](./buying-storage.md#selecting-a-batch) its batch ID. ## Get Recipient Info (Full Node Only) This step **must be performed by the receiving full node**. It retrieves the node’s **overlay address** and **PSS public key**, which must then be shared with the sending node: - The **overlay address** is **required** as the routing target. - The **PSS public key** is **optional** and only needed for encryption. ```js const bee = new Bee('http://localhost:1633') async function checkAddresses() { const addresses = await bee.connectivity.getNodeAddresses() console.log('Node Addresses:') console.log('Overlay:', addresses.overlay.toHex()) console.log('Ethereum:', addresses.ethereum.toHex()) console.log('Public Key:', addresses.publicKey.toHex()) console.log('PSS Public Key:', addresses.pssPublicKey.toHex()) console.log('Underlay:', addresses.underlay) } checkAddresses() ``` Example output: ```bash Node Addresses: Overlay: 1e2054bec3e681aeb0b365a1f9a574a03782176bd3ec0bcf810ebcaf551e4070 Ethereum: 9a73f283cd9211b96b5ec63f7a81a0ddc847cd93 Public Key: 7d0c4759f689ea3dd3eb79222870671c492cb99f3fade275bcbf0ea39cd0ef6e25edd43c99985983e49aa528f3f2b6711085354a31acb4e7b03559b02ec868f0 PSS Public Key: 5ade58d20be7e04ee8f875eabeebf9c53375a8fc73917683155c7c0b572f47ef790daa3328f48482663954d12f6e4739f748572c1e86bfa89af99f17e7dd4d33 Underlay: [ '/ip4/127.0.0.1/tcp/1634/p2p/QmcpSJPHuuQYRgDkNfwziihVcpuVteoNxePvfzaJyp9z7j', '/ip4/172.17.0.2/tcp/1634/p2p/QmcpSJPHuuQYRgDkNfwziihVcpuVteoNxePvfzaJyp9z7j', '/ip6/::1/tcp/1634/p2p/QmcpSJPHuuQYRgDkNfwziihVcpuVteoNxePvfzaJyp9z7j' ] ``` The `Overlay` and `PSS Public Key` values should be shared with the sending node. The sender (which can be a light node or a full node) needs the **overlay address** to generate the message target, and can optionally use the **PSS public key** to encrypt the message. ## Listen for Messages (Full Node) You can listen on a topic using both **continuous subscription** and **one-time receive**: - `bee.messaging.pssSubscribe()` is used to set up a continuous subscription. - `bee.messaging.pssReceive()` is used to set up a listener on a timeout which closes after receiving a message. :::caution `onClose` is required The handler passed to `bee.messaging.pssSubscribe()` must provide all three callbacks: `onMessage`, `onError` and `onClose`. Leaving `onClose` out throws `Expected function for onClose, got: undefined` before the subscription is opened. ::: ```js const bee = new Bee('http://localhost:1633') // Generate a topic from a unique string const topic = Topic.fromString('pss-demo') console.log('Subscribing to topic:', topic.toHex()) // Continuous subscription const subscription = bee.messaging.pssSubscribe(topic, { onMessage: msg => console.log('Received via subscription:', msg.toUtf8()), onError: err => console.error('Subscription error:', err.message), onClose: () => console.log('Subscription closed.'), }) // Call subscription.cancel() when you are done listening // One-time receive (3 hour timeout) async function receiveOnce() { try { console.log('Waiting for one-time message...') const message = await bee.messaging.pssReceive(topic, 1000 * 60 * 60 * 3) console.log('One-time received:', message.toUtf8()) } catch (err) { console.error('pssReceive error or timeout:', err.message) } } receiveOnce() ``` In this script we generate a `topic` from our chosen string with the `Topic.fromString()` method, then subscribe to that topic with `bee.messaging.pssSubscribe()` and set up a one-off listener with `bee.messaging.pssReceive()`. Once a chunk carrying a PSS message for that topic is synced into our node's neighborhood, the subscription passes it to the `onMessage` callback, while `bee.messaging.pssReceive()` returns it as the resolved value in our `receiveOnce` function. ## Send Message (Light or Full Node) The sender must provide: - A valid **postage batch ID** - The recipient’s **overlay address** (used to generate the routing target) - Optionally the **PSS public key** for encryption ```js const bee = new Bee('http://localhost:1643') const BATCH_ID = '6d8118c693423eef41796d58edbbffb76881806a0f44da728bf80f0c1aafa783' // The overlay address of the receiving node const recipientOverlay = '1e2054bec3e681aeb0b365a1f9a574a03782176bd3ec0bcf810ebcaf551e4070' // Generate a topic using the same string shared by the receiving node const topic = Topic.fromString('pss-demo') // Set the number of leading prefix bits to mine for the chunk bearing the PSS message const target = Utils.makeMaxTarget(recipientOverlay) // The PSS message payload const message = 'Hello from the light node!' async function send() { try { await bee.messaging.pssSend(BATCH_ID, topic, target, message) console.log('Message sent via PSS.') } catch (err) { console.error('Failed to send message:', err.message) } } send() ``` ## Encrypt with PSS Public Key To encrypt the message specifically for the recipient, include their **PSS public key** in the send call: ```js const recipientPssPublicKey = '5ade58d20be7e04ee8f875eabeebf9c53375a8fc73917683155c7c0b572f47ef790daa3328f48482663954d12f6e4739f748572c1e86bfa89af99f17e7dd4d33' await bee.messaging.pssSend(BATCH_ID, topic, target, message, recipientPssPublicKey) ``` The message is then encrypted with the recipient node's PSS public key before it is sent. Every node in the recipient's neighborhood receives the chunk carrying the message, but only the recipient can decrypt it. --- ## SOC and Feeds Swarm provides the ability to store content in content-addressed [chunks](https://docs.ethswarm.org/docs/concepts/DISC/#content-addressed-chunks-and-single-owner-chunks) (CAC) whose addresses are derived from the chunk data, or Single Owner Chunks (SOC) whose addresses are derived from the uploader's address and chosen identifier. With single owner chunks, a user can assign arbitrary data to an address and attest chunk integrity with their digital signature. Feeds are a unique feature of Swarm which simulate the publishing of mutable content on Swarm's immutable storage. ***Feeds constitute the primary use case for SOCs.*** Developers can use feeds to version revisions of a mutable resource by indexing sequential updates to a topic at predictably calculated addresses. Because feeds are built on top of SOCs, their interfaces are somewhat similar and use common concepts. ## Requirements Interactions with SOC and feeds require the following: * A fully initialized Bee light node running with fully synced postage batch data (running at `http://localhost:1633` by default). * A valid postage batch ID. * A dedicated Ethereum-compatible publisher private key to sign updates. Do **not** use the private key of your Bee node or any wallet that holds funds. :::tip You can use the `PrivateKey` class to generate a dedicated publisher key for signing SOC and feed updates: ```js // Generate 32 random bytes and construct a private key const bytes = crypto.randomBytes(32) const privateKey = new PrivateKey(bytes) console.log('Private key:', privateKey.toHex()) console.log('Public address:', privateKey.publicKey().address().toHex()) ``` Example output: ```bash Private key: 634fb5a872396d9693e5c9f9d7233cfa93f395c093371017ff44aa9ae6564cdd Public address: 8d3766440f0d7b949a5e32995d09619a7f86e632 ``` Store this key securely. Anyone with access to it can publish to your feed or SOC. *It is recommended to use a separate publishing key for each feed or SOC. This limits the damage if a key is ever exposed — a compromised key should only allow publishing to one resource, not all of them.* ::: ## Single Owner Chunks `bee-js` calculates a SOC Swarm reference hash as the keccak256 hash of the concatenation of the `identifier` and `owner` Ethereum address. The `identifier` is a 32-byte arbitrary value (by default a hex string or a `Uint8Array`). The `owner` is an Ethereum address that consists of 20 bytes in a format of a hex string or `Uint8Array`. :::info SOCs are a powerful and flexible low-level feature that provides the foundation for higher level abstractions such as [GSOC](./gsoc.md) and [feeds](./soc-and-feeds.md#feeds). For most common use cases developers are recommended to use these higher level abstractions rather than interacting directly with SOCs themselves. ::: :::warning SOCs are immutable! You might be tempted to modify a SOC's content to "update" the chunk. Reuploading a SOC is discouraged as its behavior is undefined. Either use a different `identifier`, or you might be looking for feeds if you need to perform multiple updates to the same content. ::: ### Uploading SOCs To write a Single Owner Chunk (SOC), use the `bee.soc.makeWriter()` method. This method requires a signer, which can be an instance of `PrivateKey`, a raw Ethereum private key as a hex string (with or without the `0x` prefix), or a `Uint8Array` representing the private key. The signer is used to cryptographically sign the chunk, using the same format Ethereum uses for signing transactions. Once the `SOCWriter` is created, you can upload a SOC by providing a `postageBatchId`, a 32-byte `identifier`, and the `data` payload. :::info Default `signer` When instantiating the `Bee` class, you can pass an Ethereum private key as the default signer, which is used whenever you do not pass one directly to `bee.soc.makeWriter`. ::: :::warning Your assets and/or privacy may be at risk We recommend using dedicated publisher private keys when writing to SOCs or Feeds. Never use the private keys of your node or a wallet that holds funds, as this may allow others to sign messages on your behalf, compromise your privacy, or lead to the loss of assets. Store your publisher keys securely, as anyone with access to them can publish updates to your feed. ::: ```js // Define your Ethereum private key (don't use your node's or real wallet's private keys) const privateKey = new PrivateKey('0x634fb5a872396d9693e5c9f9d7233cfa93f395c093371017ff44aa9ae6564cdd') // Print the identifier and address which can be used to retrieve the SOC console.log("SOC identifier") console.log(new Bytes(NULL_IDENTIFIER).toHex()) // Print Ethereum address console.log("Ethereum address") console.log(privateKey.publicKey().address().toHex()) // Initialize Bee client with default signer and Swarm node URL const bee = new Bee('http://localhost:1643', { signer: privateKey }) // Replace with your own valid postage batch ID here const postageBatchId = 'f2949db4cfa4f5140ed3ef29f651d189175a8cb9534c992d3c3212b17f0b67f7' // Create the SOC writer const socWriter = bee.soc.makeWriter(privateKey) // The data you want to store in the SOC const data = 'this is my sample data' async function uploadSOC() { try { // Upload the data to the SOC using the postage batch and identifier const response = await socWriter.upload(postageBatchId, NULL_IDENTIFIER, data) // Log the human-readable reference (hex string) console.log("SOC reference:") console.log("Reference (Hex):", response.reference.toHex()) } catch (error) { // Handle any errors during the upload console.error("Error uploading SOC:", error) } } // Call the function to write the SOC uploadSOC() ``` Example output: ```bash SOC identifier 0000000000000000000000000000000000000000000000000000000000000000 Ethereum address 8d3766440f0d7b949a5e32995d09619a7f86e632 SOC reference: Reference (Hex): 9d453ebb73b2fedaaf44ceddcf7a0aa37f3e3d6453fea5841c31f0ea6d61dc85 ``` In this example: - `privateKey` (initialized using our [previously generated](#requirements) publisher key) is used to initialize the writer as `socWriter` which is used to sign the SOC. - `NULL_IDENTIFIER` is the 32-byte value used as the identifier (can be replaced with any user-defined value). - `socWriter.upload()` signs and uploads the data, returning a `reference` as confirmation. The `identifier` and Ethereum address together determine the SOC address and must match exactly when retrieving the chunk later. The returned `reference` is included as part of the upload response, but unlike non-SOC uploads it is not what you use to retrieve the chunk. The `identifier` and Ethereum address are used instead, as shown in the next section. ### Retrieving SOCs To retrieve a previously uploaded SOC, you must know the Ethereum address of the owner (the signer used to upload the SOC) and the exact 32-byte `identifier` used during upload. These two values uniquely determine the SOC address in Swarm. To download a SOC in bee-js, use the `bee.soc.makeReader()` method. This method takes the owner's Ethereum address (as an `EthAddress` instance, a hex string, or a `Uint8Array`) and returns a `SOCReader` object. You can then call `.download(identifier)` on the reader to retrieve the chunk's data. :::info SOC address is derived from the identifier and owner Unlike uploads using content addressed chunks which are retrieved by their Swarm reference hash, SOCs are retrieved using the combination of `identifier` and `owner`, not their Swarm reference hash. ::: ```js // Initialize Bee client pointing to the Swarm node const bee = new Bee('http://localhost:1633') // The owner's Ethereum address (20 bytes) const owner = '8d3766440f0d7b949a5e32995d09619a7f86e632' // Create a SOC reader object bound to the owner const socReader = bee.soc.makeReader(owner) async function readSOC() { try { // Download the SOC using the identifier const response = await socReader.download(NULL_IDENTIFIER) // Log the data console.log("SOC Data:", response.payload.toUtf8()) // Optionally, you can use the data in other ways (e.g., process, display, etc.) } catch (error) { // Handle any errors during download console.error("Error downloading SOC:", error) } } // Call the function to read the SOC readSOC() ``` In this example: - The `owner` is the Ethereum address used to retrieve the SOC (derived from the private key [previously generated](#requirements)). - `NULL_IDENTIFIER` is the same default identifier used in the earlier upload example. - The returned payload is a `Bytes` object, and `.toUtf8()` converts it to a human-readable string. Make sure the `owner` and `identifier` values match exactly what was used during upload — any mismatch will result in the chunk not being found. ## Feeds Feeds are an abstraction built on top of Single Owner Chunks (SOCs) that **simulate mutable content** in Swarm. They enable sequenced updates over time while maintaining a stable access point. Feeds are ideal for dynamic content like apps, messages, or websites. Each update is stored in a new immutable chunk at a deterministically calculated address. > Although feeds appear "mutable," no data is ever modified—new updates are simply written to new indices. Similar to how a SOC is defined by an `owner` and `identifier`, a feed is defined by: * `owner`: an Ethereum-compatible address * `topic`: a unique 32-byte identifier ### Concepts * **Feed Writing**: Publishers sign and write updates associated with specific topics to specific indices using their private key. * **Append-Only Behavior and Index Resolution**: Feeds are typically used in an append-only fashion, though skipping indices is possible. However, the latest update is resolved as the highest *consecutive* index. Updates at non-consecutively written indices must be retrieved explicitly. * **No Overwriting**: Each index can be written only once. Updates are permanent. * **Feed Reading**: Readers resolve updates using the `owner` and `topic`. By default, if no index is specified they fetch the latest consecutively written index. * **Payloads**: Feed payloads can be strings, JSON, or Swarm references. Payload size is limited to a single 4 KB chunk. ### Creating and Updating Feeds Using Topics This script demonstrates how to create two distinct feeds using different topics and update them using two methods: `uploadPayload()` and `uploadReference()`. * **`uploadReference()`**: Used for uploading references to other content on Swarm. * **`uploadPayload()`**: Directly stores an arbitrary data payload in the feed. Although it is possible to update feeds with an arbitrary data payload using `uploadPayload()`, for most use cases the content should be uploaded separately (such as with `bee.file.upload()`), and the feed will be updated with the reference of that upload using the `uploadReference()` method. :::note `FeedWriter.upload()` and `FeedReader.download()` still work but are deprecated, because it is ambiguous whether the value is a payload or a reference. Use `uploadReference()` / `uploadPayload()` and `downloadReference()` / `downloadPayload()` instead. ::: The script below performs the following steps: 1. Initializes the Bee client and derives the feed owner address from a private key (which we have [previously generated](#requirements)). 2. Uses the `uploadPayload()` method to upload a plain text string as a **payload update** to the feed with topic `"payload-update"`. 3. Uploads the same string as a file to Swarm and obtains a reference. 4. Uses the `uploadReference()` method to upload the obtained reference as a **reference update** to the feed with topic `"reference-update"`. ```js const BEE_URL = 'http://localhost:1643' // Make sure to replace with a valid batch ID const POSTAGE_BATCH_ID = 'c119705f257c0015a062b17929e3ca3269e158231324707f2ea6e72c5c9f9b78' // Any Ethereum style private key can be used, ideally dedicated to this feed only. Using your node or wallet's key is strongly discouraged. const privateKey = new PrivateKey('0x0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef') const bee = new Bee(BEE_URL) const owner = privateKey.publicKey().address() // This owner address can be shared along with the topic to enable anyone to retrieve updates from the feed console.log('Feed owner address:') console.log(owner.toHex()) async function run() { const message = 'This is a test announcement.' const topic1 = Topic.fromString('payload-update') // The writer is constructed from the topic and private key, and can be used for writing feed updates (it also supports reading from feeds) const writer1 = bee.feed.makeWriter(topic1, privateKey) await writer1.uploadPayload(POSTAGE_BATCH_ID, message) console.log('✅ First feed updated with payload.') const result = await bee.file.upload(POSTAGE_BATCH_ID, message, 'announcement.txt') console.log(result) console.log(result.reference.toHex()) // The second writer is constructed using a new topic and the same private key const topic2 = Topic.fromString('reference-update') const writer2 = bee.feed.makeWriter(topic2, privateKey) await writer2.uploadReference(POSTAGE_BATCH_ID, result.reference) console.log('✅ Second feed updated with reference.') } run().catch(console.error) ``` ### Retrieving from Feeds by Topic and Owner This script demonstrates how to retrieve data from feeds using their `topic` and `owner`. There are two primary methods used for reading from feeds: * **`downloadPayload()`** – Used to read the raw payload written directly to the feed. * **`downloadReference()`** – Used to read a Swarm reference from the feed. The returned reference can then be passed to `bee.file.download()` to retrieve the associated file. The script performs the following steps: 1. Initializes the Bee client and derives the feed owner address from a private key. 2. Reads the latest **payload update** from the feed with topic `"payload-update"` using `downloadPayload()`. 3. Reads the latest **reference update** from the feed with topic `"reference-update"` using `downloadReference()`, then retrieves the associated file from Swarm using `bee.file.download()`. Feed readers always require a topic and an owner address. By default, they fetch the latest *consecutively written* update. To retrieve a specific update, an explicit index can be provided. :::warning While not explicitly enforced, it is strongly recommended to use feeds in an append-only fashion. If instead non-consecutive updates are performed, the only way to discover an update at a higher, non-consecutively written index is to walk the indices one by one until you reach it. ::: ```js const BEE_URL = 'http://localhost:1643' async function run() { const bee = new Bee(BEE_URL) const privateKey = new PrivateKey('0x0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef') const owner = privateKey.publicKey().address() // Read from payload-update feed const topic1 = Topic.fromString('payload-update') const reader1 = bee.feed.makeReader(topic1, owner) console.log('\n Reading latest update for feed: "payload-update"') try { const latest = await reader1.downloadPayload() const text = latest.payload.toUtf8() console.log('Message (as plain text):', text) console.log('Feed index:', latest.feedIndex.toBigInt()) console.log('Next index:', latest.feedIndexNext.toBigInt()) } catch (error) { console.warn('❌ Failed to read update:', error.message) } // Read from reference-update feed const topic2 = Topic.fromString('reference-update') const reader2 = bee.feed.makeReader(topic2, owner) console.log('\n Reading latest update for feed: "reference-update"') try { const latest = await reader2.downloadReference() const referenceHex = latest.reference.toHex() console.log('Swarm reference (hex):', referenceHex) const file = await bee.file.download(referenceHex) console.log('Retrieved file content:', file.data.toUtf8()) console.log('Feed index:', latest.feedIndex.toBigInt()) console.log('Next index:', latest.feedIndexNext.toBigInt()) } catch (error) { console.warn('❌ Failed to read update:', error.message) } } run().catch(console.error) ``` ### Using Feed Manifests for Fixed References Feed manifests allow you to expose a feed through a **stable Swarm reference** that always resolves to the latest update. This is especially useful for hosting evolving content like websites or files, without needing to share a new Swarm reference each time content changes. With a manifest, you can: * Retrieve the **latest feed update** through a static `/bzz//` URL. * Share a single reference that always resolves to the **current content**. * Enable compatibility with public gateways and ENS domains. The script below performs the following steps: 1. Initializes the Bee client and creates a feed manifest using a topic and owner. 2. Checks the current feed index or starts from index 0. 3. Uploads two updates to Swarm and stores their references in the feed at consecutive indices. 4. After each update, retrieves the content using the same manifest reference, confirming it resolves to the latest. ```js const BEE_URL = 'http://localhost:1643' const POSTAGE_BATCH_ID = 'c119705f257c0015a062b17929e3ca3269e158231324707f2ea6e72c5c9f9b78' const bee = new Bee(BEE_URL) const privateKey = new PrivateKey('0x0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef') const owner = privateKey.publicKey().address() console.log('Feed owner:', owner.toHex()) const topic = Topic.fromString('uploaded-reference-demo') const manifestReference = await bee.feed.createManifest(POSTAGE_BATCH_ID, topic, owner) console.log('\n Manifest created:') console.log('Ref:', manifestReference.toString()) console.log('URL:', `${BEE_URL}/bzz/${manifestReference.toString()}/`) const reader = bee.feed.makeReader(topic, owner) let index try { const latest = await reader.downloadReference() index = latest.feedIndexNext console.log(`\n Latest index: ${latest.feedIndex.toBigInt()}`) } catch { index = FeedIndex.fromBigInt(0n) console.log('\n No updates yet. Starting at index 0') } for (let i = 0; i < 2; i++) { const content = `Update ${index.toBigInt()}` const upload = await bee.file.upload(POSTAGE_BATCH_ID, content, `update-${i}.txt`) const writer = bee.feed.makeWriter(topic, privateKey) await writer.uploadReference(POSTAGE_BATCH_ID, upload.reference, { index }) console.log(`\n✅ Updated to index ${index.toBigInt()}: "${content}"`) const result = await bee.file.download(manifestReference) console.log(` Retrieved via manifest: "${result.data.toUtf8()}"`) console.log(`URL: ${BEE_URL}/bzz/${manifestReference.toString()}/`) index = index.next() } ``` ### Non-Sequential Feed Updates (Discouraged) Although feeds are typically updated in a sequential, append-only manner, it is possible to manually write to a specific index using the `index` option. However, only the **highest consecutively filled index** is considered the latest. Any gaps will result in newer updates at higher indices being ignored when resolving the latest feed content. For example: ```js await writer.uploadPayload(POSTAGE_BATCH_ID, 'Initial update') // Goes to index 0 await writer.uploadPayload(POSTAGE_BATCH_ID, 'Out-of-order update', { index: 5 }) ``` Now, attempting to read the latest update without specifying an index will still return the update at index 0: ```js const latest = await reader.downloadPayload() console.log(latest.payload.toUtf8()) // → "Initial update" ``` To read the out-of-order update at index 5, you must explicitly specify it: ```js const manual = await reader.downloadPayload({ index: 5 }) console.log(manual.payload.toUtf8()) // → "Out-of-order update" ``` :::caution Manually writing to skipped indices is supported but not recommended. Stick to the default behavior when performing feed updates (no `index` specified) to maintain a clean, append-only feed history and ensure new updates are easily discoverable. ::: ## Rolling Feeds A sequential feed grows with every update, and resolving the latest update means walking all of its indices. When the postage batch behind the early updates expires and those chunks are evicted, the walk breaks and the latest update can no longer be found. A rolling feed avoids this by restarting the feed every `periodLength` seconds. Each period gets its own topic, derived from the base topic and the period index, so a reader only ever looks at the updates written in the current period. Rolling feeds are available through the `bee.rollingFeed` namespace, which provides `makeWriter` and `makeReader`. The writer and reader must use the same base topic and the same `periodLength`. ### Keeping a Rolling Feed Alive Each `uploadPayload()` or `uploadReference()` call writes the update to the current period and mirrors it into the next one. The reader checks the current period and falls back to the previous one if it is empty. A period that nobody writes to stays empty, so a rolling feed only stays readable while the writer keeps publishing. Keeping the feed alive is the application's job. Run the writer on a timer and republish on every tick, even when the data has not changed. Ticking twice per period means a slow or delayed write still lands inside its own period. ### Writing to a Rolling Feed ```js const bee = new Bee('http://localhost:1633') // Make sure to replace with a valid batch ID const POSTAGE_BATCH_ID = 'c119705f257c0015a062b17929e3ca3269e158231324707f2ea6e72c5c9f9b78' const privateKey = new PrivateKey('0x0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef') const topic = Topic.fromString('my-rolling-feed') const periodLength = 600 // 10 minutes const writer = bee.rollingFeed.makeWriter(topic, privateKey, periodLength) let latest = 'Hello, World!' await writer.uploadPayload(POSTAGE_BATCH_ID, latest) const handle = setInterval(async () => { try { await writer.uploadPayload(POSTAGE_BATCH_ID, latest) } catch (error) { console.error('Rolling feed heartbeat failed', error) } }, (periodLength / 2) * 1000) process.on('SIGTERM', () => clearInterval(handle)) ``` To publish content uploaded separately, use `uploadReference()` in the same way as with a regular feed writer. ### Resuming After Downtime If the writer was down for at least one whole period, the periods it missed are empty. Before restarting the timer, check `writer.isCaughtUp()` and call `writer.catchUp()` to backfill the gap with the last known update: ```js if (!(await writer.isCaughtUp())) { await writer.catchUp(POSTAGE_BATCH_ID) } ``` `catchUp()` never writes the current period itself, which is left to the regular heartbeat. It looks back at most `maxBackfill` periods (its third argument, default `1`) for the last populated period, and throws if it finds none. Use it after restarts, not on the very first run of a new feed. ### Reading from a Rolling Feed ```js const bee = new Bee('http://localhost:1633') const owner = new EthAddress('0x8d3766440f0d7b949a5e32995d09619a7f86e632') const topic = Topic.fromString('my-rolling-feed') const periodLength = 600 // must match the writer const reader = bee.rollingFeed.makeReader(topic, owner, periodLength) const result = await reader.downloadPayload() console.log(result.payload.toUtf8()) // Prints 'Hello, World!' ``` For a feed updated with `uploadReference()`, use `reader.downloadReference()` instead and pass the returned reference to `bee.file.download()` or `bee.data.download()`. :::caution Because the topic changes every period, a [feed manifest](#using-feed-manifests-for-fixed-references) cannot point to a rolling feed. Readers need the owner address, the base topic and the period length. ::: --- ## Staking Operating a Bee full node and staking BZZ makes you eligible to participate in the redistribution game — a mechanism for earning additional BZZ by sharing disk space with the Swarm network. This guide shows how to use `bee-js` to deposit stake and check your node's staking status. :::danger ⚠️ **Important:** Committed stake is **non-refundable**. Only the *surplus* above the amount your node has committed to the redistribution game can be withdrawn, using `bee.stake.withdrawSurplus`. ::: :::info The `bee.stake` namespace covers depositing stake, reading the staked, withdrawable and minimum deposit amounts, withdrawing surplus stake, checking the node's status in the redistribution game, and pausing its participation. [Reserve doubling](https://docs.ethswarm.org/docs/bee/working-with-bee/staking#reserve-doubling) is configured on the node itself rather than through `bee-js`. For a complete guide to the requirements and configuration for staking, refer to the [Bee documentation](https://docs.ethswarm.org/docs/bee/working-with-bee/staking). ::: ## Stake BZZ To stake, use the `bee.stake.deposit` method. It accepts either a `BZZ` instance or a value in PLUR, the smallest unit of BZZ (like wei in Ethereum). The `BZZ` utility class simplifies conversion from a decimal string to PLUR. The deposit must be at least the minimum reported by `bee.stake.getMinimumDeposit`, otherwise Bee rejects it with `400`. The method returns `null` when the node cannot determine the minimum, for example when the price oracle is unavailable. ```js const bee = new Bee('http://localhost:1633') async function main() { const minimum = await bee.stake.getMinimumDeposit() console.log('Minimum deposit:', minimum ? `${minimum.toDecimalString()} BZZ` : 'unknown') // Convert 10 BZZ to PLUR const amount = BZZ.fromDecimalString('10') const txHash = await bee.stake.deposit(amount) console.log('Stake deposited. Transaction hash:', txHash.toHex()) } main().catch(console.error) ``` Example output: ```bash Minimum deposit: 10.0000000000000000 BZZ Stake deposited. Transaction hash: e1b86eebc54b465d84ab278da94a387e9786076557ab8f3fe04ba1b52dc065c8 ``` A successful staking transaction will return the transaction hash which you can look up on a blockchain explorer like [Gnosisscan](https://gnosisscan.io/tx/0xe1b86eebc54b465d84ab278da94a387e9786076557ab8f3fe04ba1b52dc065c8). ## Check Staking Status After staking, you can confirm the deposited amount and monitor your node’s participation in the redistribution game: ```js const bee = new Bee('http://localhost:1633') async function main() { const stake = await bee.stake.get() const redistributionState = await bee.stake.getRedistributionState() console.log('Current staked amount:', stake.toDecimalString(), 'BZZ') console.log('\nRedistribution State:') console.log(JSON.stringify(redistributionState, null, 2)) } main().catch(console.error) ``` Example output: ```bash Current staked amount: 10.0000000000000001 BZZ Redistribution State: { "minimumGasFunds": { "state": "274506772500000" }, "hasSufficientFunds": true, "isFrozen": false, "isFullySynced": true, "phase": "claim", "round": 261311, "lastWonRound": 0, "lastPlayedRound": 0, "lastFrozenRound": 0, "lastSelectedRound": 0, "lastSampleDurationSeconds": 0, "block": 39719372, "reward": { "state": "0" }, "fees": { "state": "0" }, "isHealthy": true, "enabled": true, "hasCommittedThisRound": false, "hasRevealedThisRound": false } ``` For details on interpreting these values, refer to the [staking status section](https://docs.ethswarm.org/docs/bee/working-with-bee/staking#check-status) of the Bee documentation. ## Pause Redistribution `bee.stake.setRedistributionEnabled` turns the node's participation in new redistribution rounds on or off, and returns the resulting state. The current state is reported in the `enabled` field of `bee.stake.getRedistributionState()`. ```js const bee = new Bee('http://localhost:1633') async function main() { const enabled = await bee.stake.setRedistributionEnabled(false) console.log('Redistribution enabled:', enabled) } main().catch(console.error) ``` Example output: ```bash Redistribution enabled: false ``` :::note The setting is not persisted. Participation is enabled again when the node restarts. ::: ## Withdraw Surplus Stake Stake above the amount your node has committed to the redistribution game can be withdrawn back to the node wallet. Check how much is withdrawable first: ```js const bee = new Bee('http://localhost:1633') async function main() { const withdrawable = await bee.stake.getWithdrawable() console.log('Withdrawable stake:', withdrawable.toDecimalString(), 'BZZ') const txHash = await bee.stake.withdrawSurplus() console.log('Withdrawal transaction hash:', txHash.toHex()) } main().catch(console.error) ``` :::note `bee.stake.migrate()` withdraws the *entire* stake, and only works while the staking contract is paused for migration to a new contract. It is not a way to exit staking under normal conditions. ::: --- ## Checking Node Status To understand and monitor the status of your Bee node, `bee-js` provides a set of helpful methods. In this guide, we'll walk through how to retrieve and log the data needed to give a complete overview of your node's current status. ### Requirements To use the example scripts below, you need: - An instance of the `Bee` class from `bee-js` [initialized](./getting-started.md) using the API endpoint of a currently operating Bee node. ### 1. Node Health and Readiness Use these to read the health and readiness endpoints, the same values that container orchestration tools like Kubernetes rely on. ```js const bee = new Bee('http://localhost:1633') async function checkHealthAndReadiness() { const health = await bee.status.getHealth() const readiness = await bee.status.getReadiness() console.log('Health:', health) console.log('Readiness:', readiness) } checkHealthAndReadiness() ``` Output: ```bash Health: { apiVersion: '8.2.0', version: '2.8.3', status: 'ok' } Readiness: { apiVersion: '8.2.0', version: '2.8.3', status: 'ready' } ``` ### 2. Get Node Topology Use this to inspect how many peers you're connected to, and the state of your neighborhood. ```js const bee = new Bee('http://localhost:1633') async function checkTopology() { const topology = await bee.connectivity.getTopology() console.log('Topology:', topology) } checkTopology() ``` Output: *(Bins 1 - 30 omitted from `bins` result)* ```bash Topology: { baseAddr: '1e2054bec3e681aeb0b365a1f9a574a03782176bd3ec0bcf810ebcaf551e4070', population: 5619, connected: 135, timestamp: '2025-03-26T07:54:05.921263981Z', nnLowWatermark: 3, depth: 10, reachability: 'Public', networkAvailability: 'Available', bins: { bin_0: { population: 2714, connected: 16, connectedPeers: [Array], disconnectedPeers: [Array] }, ... bin_31: { population: 0, connected: 0, connectedPeers: [], disconnectedPeers: [] } } } ``` ### 3. Get Node Addresses This will give you the overlay address, underlay addresses, and Ethereum address associated with your Bee node. The Ethereum address uses the Ethereum format, but it belongs to a Gnosis Chain account rather than to mainnet Ethereum. ```js const bee = new Bee('http://localhost:1633') async function checkAddresses() { const addresses = await bee.connectivity.getNodeAddresses() console.log('Node Addresses:') console.log('Overlay:', addresses.overlay.toHex()) console.log('Ethereum:', addresses.ethereum.toHex()) console.log('Public Key:', addresses.publicKey.toHex()) console.log('PSS Public Key:', addresses.pssPublicKey.toHex()) console.log('Underlay:', addresses.underlay) } checkAddresses() ``` Output: ```bash Node Addresses: Overlay: 1e2054bec3e681aeb0b365a1f9a574a03782176bd3ec0bcf810ebcaf551e4070 Ethereum: 9a73f283cd9211b96b5ec63f7a81a0ddc847cd93 Public Key: 7d0c4759f689ea3dd3eb79222870671c492cb99f3fade275bcbf0ea39cd0ef6e25edd43c99985983e49aa528f3f2b6711085354a31acb4e7b03559b02ec868f0 PSS Public Key: 5ade58d20be7e04ee8f875eabeebf9c53375a8fc73917683155c7c0b572f47ef790daa3328f48482663954d12f6e4739f748572c1e86bfa89af99f17e7dd4d33 Underlay: [ '/ip4/127.0.0.1/tcp/1634/p2p/QmcpSJPHuuQYRgDkNfwziihVcpuVteoNxePvfzaJyp9z7j', '/ip4/172.17.0.2/tcp/1634/p2p/QmcpSJPHuuQYRgDkNfwziihVcpuVteoNxePvfzaJyp9z7j', '/ip6/::1/tcp/1634/p2p/QmcpSJPHuuQYRgDkNfwziihVcpuVteoNxePvfzaJyp9z7j' ] ``` ### 4. Get Version and API Compatibility Use these methods to check your node's version number and the API version number, and to check whether the API version is supported by `bee-js`. ```js const bee = new Bee('http://localhost:1633') async function checkVersions() { const versions = await bee.status.getVersions() const isSupported = await bee.status.isSupportedApiVersion() console.log('Node Versions:', versions) console.log('Is Supported API Version:', isSupported) } checkVersions() ``` Output: ```bash Node Versions: { supportedBeeVersion: '2.4.0-390a402e', supportedBeeApiVersion: '7.2.0', beeVersion: '2.5.0-5ec231ba', beeApiVersion: '7.3.0' } Is Supported API Version: true ``` ### 5. Get Node Info This provides general information such as node mode (e.g., full, light), and whether chequebook and SWAP are enabled. ```js const bee = new Bee('http://localhost:1633') async function getNodeInfo() { const info = await bee.status.getNodeInfo() console.log('Node Info:', info) } getNodeInfo() ``` Output: ```bash Node Info: { beeMode: 'light', chequebookEnabled: true, swapEnabled: true } ``` ### 6. Get Chain State Shows blockchain-related info such as the current price for storage. ```js const bee = new Bee('http://localhost:1633') async function getChainState() { const state = await bee.status.getChainState() console.log('Chain State:', state) } getChainState() ``` Output: ```bash Chain State: { block: 39230575, chainTip: 39230580, totalAmount: '204168626286', currentPrice: 41699 } ``` ### 7. Get Reserve State This tells you about your node’s local reserve size and storage metrics. ```js const bee = new Bee('http://localhost:1633') async function getReserveState() { const reserveState = await bee.status.getReserveState() console.log('Reserve State:', reserveState) } getReserveState() ``` Output: ```bash Reserve State: { commitment: 17360879616, radius: 13, storageRadius: 0 } ``` ### Run All Checks Together You can combine all of the above into one function to quickly inspect the full status of your node: ```js const bee = new Bee('http://localhost:1633') async function checkHealthAndReadiness() { const health = await bee.status.getHealth() const readiness = await bee.status.getReadiness() console.log('Health:', health) console.log('Readiness:', readiness) } async function checkTopology() { const topology = await bee.connectivity.getTopology() console.log('Topology:', topology) } async function checkAddresses() { const addresses = await bee.connectivity.getNodeAddresses() console.log('Node Addresses:') console.log('Overlay:', addresses.overlay.toHex()) console.log('Ethereum:', addresses.ethereum.toHex()) console.log('Public Key:', addresses.publicKey.toHex()) console.log('PSS Public Key:', addresses.pssPublicKey.toHex()) console.log('Underlay:', addresses.underlay) } async function checkVersions() { const versions = await bee.status.getVersions() const isSupported = await bee.status.isSupportedApiVersion() console.log('Node Versions:', versions) console.log('Is Supported API Version:', isSupported) } async function getNodeInfo() { const info = await bee.status.getNodeInfo() console.log('Node Info:', info) } async function getChainState() { const state = await bee.status.getChainState() console.log('Chain State:', state) } async function getReserveState() { const reserveState = await bee.status.getReserveState() console.log('Reserve State:', reserveState) } async function checkNodeStatus() { console.log('\n\n=== Node Health and Readiness ===') await checkHealthAndReadiness() console.log('\n\n=== Node Topology ===') await checkTopology() console.log('\n\n=== Node Addresses ===') await checkAddresses() console.log('\n\n=== Version and API Compatibility ===') await checkVersions() console.log('\n\n=== Node Info ===') await getNodeInfo() console.log('\n\n=== Chain State ===') await getChainState() console.log('\n\n=== Reserve State ===') await getReserveState() } checkNodeStatus() ``` --- ## Tracking Uploads You can track the progress of deferred uploads using "tags". Each tag tracks how many chunks were **split**, **stored**, **seen**, and **synced** by the network. By creating a tag before uploading and passing it to the upload function, you make the upload *trackable*, allowing you to confirm whether your uploaded data has been fully synced. :::info Tracking with tags is used ***only for [deferred uploads](./upload-download.md#deferred-uploads)***. That is because when content is uploaded in a deferred manner, the content's reference hash will be returned *immediately*, often before the content has been fully synced to the network. Therefore, tags should be used to confirm when the content has been fully synced and is retrievable. With direct uploads, the reference hash is not returned until after the content has already been uploaded and fully synced to the network, so there is no need to track it after uploading. ::: ## How It Works ### 1. Create a Tag Before uploading, create a new tag using `bee.tag.create()`. This returns a unique tag UID that will be used to monitor the upload. ```js const tag = await bee.tag.create() console.log("Created new tag with UID:", tag.uid) ``` Alternatively, you can use an existing tag from `bee.tag.getAll()` (useful for testing or reuse): ```js const allTags = await bee.tag.getAll() const tag = allTags[0] if (tag) { console.log("Using existing tag with UID:", tag.uid) } ``` ### 2. Upload a File with the Tag To enable tracking, pass the tag UID into the upload options under the `tag` key: ```js const result = await bee.file.upload(postageBatchId, fileData, 'nodes.json', { tag: tag.uid, contentType: 'application/json' }) ``` This links the upload to your tag so you can monitor its progress. ### 3. Track Tag Progress Use `bee.tag.get(tagUid)` to monitor upload progress. Chunks that have **already been synced in the past** are counted in `seen`, while newly synced ones are in `synced`. Poll repeatedly until: ```text synced + seen === split ``` This indicates that all chunks have either just synced or were already present in the network. ```js const tag = await bee.tag.get(tagUid) console.log(` - Total split: ${tag.split}`) console.log(` - Synced: ${tag.synced}`) console.log(` - Seen: ${tag.seen}`) ``` ## Example Script ```js const bee = new Bee('http://localhost:1633') const postageBatchId = "129903062bedc4eca6fc1c232ed385e93dda72f711caa1ead6018334dd801cee" async function waitForTagSync(tagUid, interval = 800) { while (true) { const tag = await bee.tag.get(tagUid) console.log(`Progress (Tag ${tagUid}):`) console.log(` - Total split: ${tag.split}`) console.log(` - Stored: ${tag.stored}`) console.log(` - Seen: ${tag.seen}`) console.log(` - Synced: ${tag.synced}`) if (tag.split > 0 && tag.synced + tag.seen >= tag.split) { console.log("Upload fully synced!") break } await new Promise(resolve => setTimeout(resolve, interval)) } } async function uploadNodesJsonWithTag() { try { const fileData = await fs.readFile('./nodes.json') const tag = await bee.tag.create() console.log("Created new tag with UID:", tag.uid) const result = await bee.file.upload(postageBatchId, fileData, 'nodes.json', { tag: tag.uid, contentType: 'application/json' }) console.log("Uploaded reference:", result.reference.toHex()) await waitForTagSync(tag.uid) } catch (error) { console.error("Error uploading nodes.json:", error.message) } } uploadNodesJsonWithTag() ``` ### Example Terminal Output ```bash Created new tag with UID: 85 Uploaded reference: 78e5247e97b1a3362b6c3f054924dce734e0ffd7df0cb5ed9b636cb6a4a14d93 Progress (Tag 85): - Total split: 1078 - Stored: 0 - Seen: 0 - Synced: 546 Progress (Tag 85): - Total split: 1078 - Stored: 0 - Seen: 0 - Synced: 1078 Upload fully synced! ``` ## Deleting Tags You can delete tags you no longer need using their UID: ```js await bee.tag.delete(tag.uid) console.log("Deleted tag:", tag.uid) ``` ## References - [Bee docs – Syncing / Tags](https://docs.ethswarm.org/docs/develop/access-the-swarm/syncing) - [Bee API Reference – `/tags`](https://docs.ethswarm.org/api/#tag/Tag) --- ## Upload and Download Uploading and downloading with Swarm is easy with `bee-js`. Depending on your needs, you can upload unstructured data, single files, lists of files, or entire directories. Each upload will return a Swarm reference hash, which is a unique identifier for the upload that can be used to download the uploaded content. ## Requirements To use the example scripts below, you need: - An instance of `bee-js`'s `Bee` [initialized](./getting-started.md) as `bee` using the API endpoint of a currently operating Bee node. - The batch ID of a previously purchased usable postage batch with enough `remainingSize` left to upload the desired data. If you don't have one already, you will need to [buy a batch](./buying-storage.md#purchasing-storage) to upload data. If you do have one, you will need to [get and save](./buying-storage.md#selecting-a-batch) its batch ID. ## Arbitrary Data You can upload and retrieve any `string` or `Uint8Array` data with the `bee.data.upload` and `bee.data.download` functions. When you download data the return type is `Bytes`. The `Bytes` class includes various convenience functions like: - `toUtf8()` that converts the bytes into a UTF-8 encoded string - `toHex()` that converts the bytes to a hex string - `parsePayloadAsJson()` that parses the bytes as JSON and returns the resulting object :::info The `Bytes` class is a core data type in `bee-js`. It includes a variety of useful utility methods which you can learn more about on the [Utility Classes](./utilities.md) page. ::: ```js const bee = new Bee('http://localhost:1633') const postageBatchId = "129903062bedc4eca6fc1c232ed385e93dda72f711caa1ead6018334dd801cee" const jsonData = { message: "Bee is awesome!", features: ["decentralized", "reliable", "scalable"], version: 1.0 }; const jsonString = JSON.stringify(jsonData); const result = await bee.data.upload(postageBatchId, jsonString) // Prints the 64 character long hex string Swarm reference - make sure to save the reference in order to access the content later console.log(result.reference.toHex()) // Use the Swarm reference hash to download the data const retrievedData = await bee.data.download(result.reference) console.log(retrievedData) // Prints the raw data console.log(retrievedData.toUtf8()) // Prints the data as UTF-8 text console.log(retrievedData.parsePayloadAsJson()) // Prints the data parsed as JSON ``` :::info Tip A Swarm reference or hash is a 64 character long hex string which is the address of the uploaded data, file, or directory. It must be saved so it can be used later to retrieve the uploaded content. ::: Example terminal output: ```bash e2d9d04da9f8a000ddcc50e1b86fbff00c6202b406a9dd7aa55d283747858c33 Bytes { bytes: , length: 92 } {"message":"Bee is awesome!","features":["decentralized","reliable","scalable"],"version":1} { message: 'Bee is awesome!', features: [ 'decentralized', 'reliable', 'scalable' ], version: 1 } ``` ## Single Files The `bee.file.upload` function accepts a `string`, `Uint8Array`, Node.js `Readable` stream, or browser `File` object as input data, along with an optional filename and upload options. :::info When working with browsers you can use the [`File` interface](https://developer.mozilla.org/en-US/docs/Web/API/File). The filename is taken from the `File` object itself, but can be overwritten through the third argument of the `bee.file.upload` function. ::: ```js const bee = new Bee('http://localhost:1633') const postageBatchId = "ec4d7e3acbd626471b33135164335dfcb0bed889dd4a951c09da8ea7b59c1fc9" async function uploadFromDisk() { try { // Read the file from the local file system const filePath = "./textfile.txt" const fileData = readFileSync(filePath) // Upload the file data const result = await bee.file.upload(postageBatchId, fileData, "textfile.txt", { contentType: "text/plain" }) // Print the reference hash used to retrieve the content console.log(result.reference.toHex()) // Download the file const retrievedFile = await bee.file.download(result.reference.toHex()) console.log(retrievedFile.name) // Prints 'textfile.txt' console.log(retrievedFile.contentType) // Prints 'text/plain' console.log(retrievedFile.data.toUtf8()) // Prints file content return result.reference.toHex() } catch (error) { console.error("Error:", error.message) } } uploadFromDisk() ``` Example terminal output: ```bash 0dca369c5a1a1ef5be1f5e293089c695920323805568382d9e97e3cd17678a3a textfile.txt text/plain this is a sample file ``` ## Multiple Files For uploading multiple files at once in a browser environment you can use the `bee.collection.uploadFromFileList` function. *Note that it preserves the relative paths of all uploaded files, so the full paths (e.g. "folder/nested.txt") must be used when downloading them.* :::caution Browser Only The `bee.collection.uploadFromFileList` function is only supported for **browser environments**, as it requires input in the form of a [`FileList`](https://developer.mozilla.org/en-US/docs/Web/API/FileList) or array of [`File`](https://developer.mozilla.org/en-US/docs/Web/API/File) objects. While `File` is available in Node v20+, it is still not fully supported and may not always work as expected. ::: ```js const bee = new Bee('http://localhost:1633') const postageBatchId = "ec4d7e3acbd626471b33135164335dfcb0bed889dd4a951c09da8ea7b59c1fc9" async function uploadFiles() { try { // Create 3 File objects from strings with nested paths const rootFile = new File(["Root file content"], "root.txt", { type: "text/plain" }) const nestedFile = new File(["Nested file content"], "folder/nested.txt", { type: "text/plain" }) const deepFile = new File(["Deeply nested file content"], "folder/subfolder/deep.txt", { type: "text/plain" }) // Upload all files const result = await bee.collection.uploadFromFileList(postageBatchId, [rootFile, nestedFile, deepFile]) console.log("Files uploaded with reference:", result.reference.toHex()) // Download each file by full path const downloadedRoot = await bee.file.download(result.reference, 'root.txt') const downloadedNested = await bee.file.download(result.reference, 'folder/nested.txt') const downloadedDeep = await bee.file.download(result.reference, 'folder/subfolder/deep.txt') // Display contents console.log("Root file:", downloadedRoot.data.toUtf8()) console.log("Nested file:", downloadedNested.data.toUtf8()) console.log("Deep file:", downloadedDeep.data.toUtf8()) return result.reference.toHex() } catch (error) { console.error("Error:", error.message) } } uploadFiles() ``` ## Directories :::info `bee.collection.uploadFromDirectory` is not available in the browser as it relies on [`fs` from NodeJS](https://nodejs.org/api/fs.html). ::: The `bee.collection.uploadFromDirectory` function takes a directory path as input and recursively uploads all files within it, including those in all nested subdirectories, while preserving their relative paths. *When downloading files later, you must use the full relative paths exactly as they appeared during upload.* Let's assume we have the following file structure: ```bash . ├── folder │   ├── nested.txt │   └── subfolder │   └── deep.txt └── root.txt ``` ```js const bee = new Bee('http://localhost:1633') const postageBatchId = "ec4d7e3acbd626471b33135164335dfcb0bed889dd4a951c09da8ea7b59c1fc9" async function uploadDirectory() { try { // Upload the current directory (where the script is run) const result = await bee.collection.uploadFromDirectory(postageBatchId, process.cwd()) console.log("Directory uploaded successfully!") console.log("Swarm reference:", result.reference.toHex()) // Download each file using its relative path const root = await bee.file.download(result.reference, 'root.txt') const nested = await bee.file.download(result.reference, 'folder/nested.txt') const deep = await bee.file.download(result.reference, 'folder/subfolder/deep.txt') // Print out file contents console.log("root.txt:", root.data.toUtf8()) console.log("folder/nested.txt:", nested.data.toUtf8()) console.log("folder/subfolder/deep.txt:", deep.data.toUtf8()) } catch (error) { console.error("Error during upload or download:", error.message) } } uploadDirectory() ``` Example terminal output: ```bash Directory uploaded successfully! Swarm reference: 3e42f7cfbeec140129211fa24b9b57b2bff5932416dc8ff30b44c8446b259e92 root.txt: Root level content folder/nested.txt: Nested content folder/subfolder/deep.txt: Deeply nested content ``` ## Upload Options The `bee.data.upload`, `bee.collection.upload`, `bee.collection.uploadFromFileList`, and other similar methods accept an **options object** as their third argument. On `bee.file.upload` the options are the fourth argument, since the third one is the file name. This object lets you modify how the upload is handled — for example, enabling encryption, pinning data locally, or attaching a tag to track the upload. ### Pinning If you set `pin: true`, the uploaded data will be **stored locally** on your Bee node, even if it becomes unavailable on the wider Swarm network. This lets your node re-upload the content if needed: ```js await bee.data.upload(postageBatchId, 'my content', { pin: true }) ``` :::info Pinning is local only. It doesn't make data permanent across the network. ::: More info: - [Bee docs – Pinning](https://docs.ethswarm.org/docs/develop/access-the-swarm/pinning) ### Encryption You can enable **client-side encryption** by setting `encrypt: true`. This encrypts the content before uploading and returns a longer Swarm reference that includes the decryption key. **Example:** ```js await bee.data.upload(postageBatchId, 'sensitive content', { encrypt: true }) ``` When you later download the content, `bee-js` will decrypt it automatically if the reference contains the embedded key. More info: - [Store with Encryption](https://docs.ethswarm.org/docs/develop/access-the-swarm/store-with-encryption) ### Tags Tags let you **track upload progress** through the Bee API. You can create a new tag using `bee.tag.create()`, then pass its ID when uploading. **Example:** ```js const tag = await bee.tag.create() await bee.data.upload(postageBatchId, 'track me', { tag: tag.uid }) ``` You can use the tag ID to monitor syncing status: how many chunks were split, stored, seen, and synced. See the [Tracking Uploads](./tracking-uploads.md) page for more info on creating, monitoring, and managing tags. ### Deferred Uploads By default, uploads are **deferred**, meaning the client sends the data to the Bee node, generates and returns the Swarm reference hash, and the node starts syncing it to the network **in the background**. The function returns as soon as the chunks are processed and a Swarm reference is generated — **even before the data is actually available on the network**. This can be risky if you assume the data is already retrievable using the returned reference. **To ensure reliability, it is recommended to set `deferred: false`** unless you're explicitly tracking the upload using tags. **Recommended usage:** ```js await bee.data.upload(postageBatchId, 'data', { deferred: false }) ``` :::tip If you do use `deferred: true`, make sure to use a [tag](./tracking-uploads.md) to track upload progress and confirm the success of the upload. ::: --- ## Utility Classes `bee-js` includes a variety of utility classes with methods for working with different data types, keys, signatures, addresses, token values, content references, hashing, and more. :::info Where these classes live `Bytes` and its subclasses (`PrivateKey`, `PublicKey`, `Signature`, `Reference`, `Topic`, `Identifier`, `BatchId`, `Span`, `FeedIndex`, `PeerAddress`, `TransactionId`, `EthAddress`) are defined in [`@ethersphere/core-sdk`](https://www.npmjs.com/package/@ethersphere/core-sdk) and re-exported by `bee-js`, so importing them from `@ethersphere/bee-js` works exactly as shown below. Install `core-sdk` directly if you need the primitives without the HTTP client. `BZZ`, `DAI`, `Size` and `Duration` live in `bee-js` itself. ::: ## *Bytes* - Data Conversions & Manipulation The `Bytes` class in `bee-js` provides a convenient wrapper for manipulating byte arrays, converting between encodings, slicing, hashing, and more. It’s used throughout `bee-js` as the basis for other utility classes like `Signature`, `Reference`, `PrivateKey`, and more, all of which extend the `Bytes` class. It is also a **core data type** used throughout the SDK, both as an expected input and as a returned type for various methods. ```js // Import Bytes class ``` ### Hashing with `keccak256` **Methods:** - `Bytes.fromUtf8()`: Converts a UTF-8 string to a `Bytes` instance. - `Bytes.keccak256()`: Computes the keccak256 hash of the given byte input. - `toHex()`: Converts the byte data to a hexadecimal string. ```js // --- Hashing with keccak256 --- console.log('--- keccak256 Hashing ---') console.log('Empty string hash:', Bytes.keccak256(Bytes.fromUtf8('')).toHex()) console.log('Hello, world! hash:', Bytes.keccak256(Bytes.fromUtf8('Hello, world!')).toHex()) ``` ```bash --- keccak256 Hashing --- Empty string hash: c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 Hello, world! hash: b6e16d27ac5ab427a7f68900ac5559ce272dc6c37c82b3e052246c82244c50e4 ``` ### Creating *Bytes* Instances **Methods:** - `Bytes.fromUtf8()`: Creates a `Bytes` instance from a UTF-8 string. - `Bytes.fromSlice()`: Creates a `Bytes` instance from a slice of a `Uint8Array`. - `new Bytes(...)`: Constructs a new `Bytes` instance from various inputs like strings, `ArrayBuffer`, or `Uint8Array`. - `toHex()`: Converts the byte data to a hexadecimal string. ```js // --- Creating Bytes instances --- console.log('\n--- Creating Bytes Instances ---') const bytesFromString = Bytes.fromUtf8('Swarm') console.log('From UTF-8 string:', bytesFromString.toHex()) const source = new Uint8Array([1, 2, 3, 4, 5]) const slice = Bytes.fromSlice(source, 1, 3) console.log('From slice of Uint8Array:', slice.toHex()) const fromHex = new Bytes('0xdeadbeef') console.log('From hex string:', fromHex.toHex()) const cloned = new Bytes(fromHex) console.log('Cloned Bytes instance:', cloned.toHex()) const fromArray = new Bytes(new Uint8Array([16, 32, 48])) console.log('From raw Uint8Array:', fromArray.toHex()) ``` ```bash --- Creating Bytes Instances --- From UTF-8 string: 537761726d From slice of Uint8Array: 020304 From hex string: deadbeef Cloned Bytes instance: deadbeef From raw Uint8Array: 102030 ``` ### Accessing and Converting Bytes **Methods:** - `toUint8Array()`: Converts the `Bytes` instance to a `Uint8Array`. - `toHex()`: Converts the byte data to a hexadecimal string. - `toBase64()`: Converts the byte data to a Base64-encoded string. - `toBase32()`: Converts the byte data to a Base32-encoded string. - `toUtf8()`: Converts the byte data to a UTF-8 string. - `toString()`: Converts the byte data to a hexadecimal string (alias for `toHex()`). - `parsePayloadAsJson()`: Parses the byte data (assumed to be a UTF-8 JSON string) and returns the corresponding JavaScript object. - `toJSON()`: Returns the hexadecimal string, so `JSON.stringify` serializes `Bytes` as hex. ```javascript // --- Accessing and Converting Bytes --- console.log('\n--- Accessing and Converting Bytes ---') const data = Bytes.fromUtf8('hello') console.log('toUint8Array():', data.toUint8Array()) console.log('toHex():', data.toHex()) console.log('toBase64():', data.toBase64()) console.log('toBase32():', data.toBase32()) console.log('toUtf8():', data.toUtf8()) console.log('toString():', data.toString()) const json = Bytes.fromUtf8('{"a": 1, "b": true}') console.log('parsePayloadAsJson():', json.parsePayloadAsJson()) ``` ```bash --- Accessing and Converting Bytes --- toUint8Array(): Uint8Array(5) [ 104, 101, 108, 108, 111 ] toHex(): 68656c6c6f toBase64(): aGVsbG8= toBase32(): NBSWY3DP toUtf8(): hello toString(): 68656c6c6f parsePayloadAsJson(): { a: 1, b: true } ``` ## *PrivateKey* - Key Management & Signing The `PrivateKey` class extends the `Bytes` class. It is initialized with an Ethereum-style private key, which can then be used for signing arbitrary messages. It also has methods for returning the derived Ethereum address and public key. ```javascript // This example shows interoperability of crypto types // Initialize PrivateKey with 32-byte hexadecimal private key const signer = new PrivateKey('0x0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef') console.log('PrivateKey initialized:', signer.toHex()) // Message to be signed const message = 'Hello world!' console.log('Message to sign:', message) // Message signing const signature = signer.sign(message) // type Signature console.log('Generated signature:', signature.toHex()) // Public key derivation const recovered = signature.recoverPublicKey(message) // type PublicKey console.log('Recovered public key:', recovered.toHex()) // Ethereum account address derivation const address = recovered.address() // type EthAddress console.log('Recovered Ethereum address:', address.toHex()) ``` ```bash PrivateKey initialized: 0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef Message to sign: Hello world! Generated signature: 0f0b277880c01e1ed39ad3fadcbd1d317c89ed4ecc9048072a18b370eff3162f5519fa0fa307ed66bac9645bf6e1e5350b3e91a99bcf7104ecfcb6d8443b81301c Recovered public key: 4646ae5047316b4230d0086c8acec687f00b1cd9d1dc634f6cb358ac0a9a8ffffe77b4dd0a4bfb95851f3b7355c781dd60f8418fc8a65d14907aff47c903a559 Recovered Ethereum address: fcad0b19bb29d4674531d6f115237e16afce377c ``` ## *BZZ* and *DAI* - Token Conversions & Formatting ```javascript ``` **Initializing and formatting BZZ and DAI tokens.** ```javascript // --- BZZ Initialization --- console.log('--- BZZ Initialization ---') const bzz = BZZ.fromDecimalString('13.37') console.log('BZZ in PLUR String:', bzz.toPLURString()) console.log('BZZ as PLUR BigInt:', bzz.toPLURBigInt()) console.log('BZZ in Decimal String:', bzz.toDecimalString()) ``` ```bash --- BZZ Initialization --- BZZ in PLUR String: 133700000000000000 BZZ as PLUR BigInt: 133700000000000000n BZZ in Decimal String: 13.3700000000000000 ``` **DAI token initialization, converting from Wei to Decimal string and back.** ```javascript // --- DAI Initialization --- console.log('--- DAI Initialization ---') const daiFromWei = DAI.fromWei('4596417133719887384') console.log('DAI from Wei to Decimal String:', daiFromWei.toDecimalString()) console.log('DAI from Decimal String to Wei BigInt:', DAI.fromDecimalString('4.596417133719887384').toWeiBigInt()) console.log('DAI from Decimal String to Wei String:', DAI.fromDecimalString('4.596417133719887384').toWeiString()) ``` ```bash --- DAI Initialization --- DAI from Wei to Decimal String: 4.596417133719887384 DAI from Decimal String to Wei BigInt: 4596417133719887384n DAI from Decimal String to Wei String: 4596417133719887384 ``` **Performing arithmetic on BZZ amounts.** ```javascript // --- BZZ Arithmetic --- console.log('--- BZZ Arithmetic ---') const sent = BZZ.fromDecimalString('1.89') const received = BZZ.fromDecimalString('45.600000061124') console.log('BZZ after arithmetic:', sent.plus('401100000000000000').minus(received).toDecimalString()) ``` ```bash --- BZZ Arithmetic --- BZZ after arithmetic: -3.6000000611240000 ``` **Converting BZZ tokens to DAI tokens using a specified exchange rate.** ```javascript // --- Convert BZZ to DAI --- console.log('--- Convert BZZ to DAI ---') const exchangeRate = DAI.fromDecimalString('0.3659') const bzzForExchange = BZZ.fromDecimalString('1000') console.log('BZZ exchanged to DAI at rate 0.3659:', bzzForExchange.exchangeToDAI(exchangeRate).toDecimalString()) ``` ```bash --- Convert BZZ to DAI --- BZZ exchanged to DAI at rate 0.3659: 365.900000000000000000 ``` **Converting DAI tokens to BZZ tokens using the same exchange rate.** ```javascript // --- Convert DAI to BZZ --- console.log('--- Convert DAI to BZZ ---') const dai = DAI.fromDecimalString('2.591923154542010243') console.log('DAI exchanged to BZZ at rate 0.3659:', dai.exchangeToBZZ(exchangeRate).toDecimalString()) ``` ```bash --- Convert DAI to BZZ --- DAI exchanged to BZZ at rate 0.3659: 7.0836926880076803 ``` ## *Reference* - Reference Hashes and CIDs The `Reference` class is used to represent content reference hashes and CIDs, and conversions between them. ```javascript const hash = '44ef8a919a7a2a6fe36712d4512047db406cc7ac5c06da7731e0cb87bab10ff9' const cid = 'bah5acgzaitxyvem2pivg7y3hclkfcich3nagzr5mlqdnu5zr4dfypovrb74q' // Convert CID to hash (Hex) console.log('CID to Hash (Hex):', new Reference(cid).toHex()) // Convert Hash (Hex) to CID (Accepts 'manifest' or 'feed' types) console.log('Hash to CID (manifest type):', new Reference(hash).toCid('manifest')) ``` ```bash CID to Hash (Hex): 44ef8a919a7a2a6fe36712d4512047db406cc7ac5c06da7731e0cb87bab10ff9 Hash to CID (manifest type): bah5acgzaitxyvem2pivg7y3hclkfcich3nagzr5mlqdnu5zr4dfypovrb74q ``` --- ## bee-js - The Swarm JS Library `bee-js` is a JavaScript SDK for building applications using the Swarm decentralized storage and communication network. It allows you to interact with a local or remote [Bee node](https://docs.ethswarm.org/docs/) within your NodeJS project. The following documentation will guide you through installing and using `bee-js`. Take your first steps with `bee-js` in the [Getting Started section](./getting-started). :::info Note on Ethereum addresses Ethereum addresses / keys are mentioned throughout the documentation. Please note that this refers to the Ethereum format only, and does not indicate the Ethereum blockchain itself. Swarm is built on the Gnosis Blockchain which is a fork of Ethereum, and uses the same key and addressing schemes. ::: ## Development We'd love you to join us! Are you up to the challenge of helping us to create bee-js and the other incredible technologies we're building? Have a look at our GitHub organization, [Ethersphere](https://github.com/ethersphere). ## Community There is a vibrant and buzzing community behind Swarm. Get involved in one of our group channels. - [Official Swarm website](https://ethswarm.org) - [Discord room](https://discord.gg/ykCupZMuww) - [Twitter @ethswarm](https://twitter.com/ethswarm) - [Reddit channel](https://www.reddit.com/r/ethswarm/) ## Reporting a bug If anything isn't working, [get in touch and let us know!](https://github.com/ethersphere/bee-js/issues) Every Bee is important to us and we'll get right to work on fixing it for you as soon as possible. 🐝 ## Examples [`create-swarm-app`](https://github.com/ethersphere/create-swarm-app) scaffolds a working project with `bee-js` already installed and configured, including a React app built with Vite. It is the quickest way to see a complete, running example: ```bash npm init swarm-app@latest my-dapp vite-tsx ``` See [Getting Started](./getting-started) for the other available templates.