Skip to main content

Class: Chunk

Defined in: bee-js/src/modules/chunk.ts:15

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

Parameters

context

BeeContext

Returns

Chunk

Methods

download()

download(reference, options?, requestOptions?): Promise<Uint8Array<ArrayBufferLike>>

Defined in: bee-js/src/modules/chunk.ts:67

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

options?

DownloadOptions

Options that affects the request behavior

requestOptions?

BeeRequestOptions

Options for making requests, such as timeouts, custom HTTP agents, headers, etc.

Returns

Promise<Uint8Array<ArrayBufferLike>>


upload()

upload(stamp, data, options?, requestOptions?): Promise<UploadResult>

Defined in: bee-js/src/modules/chunk.ts:28

Uploads a chunk to the network.

Chunks uploaded with this method should be retrieved with download.

Parameters

stamp

Postage Batch ID or an Envelope created with the bee.createEnvelope method.

string | Uint8Array<ArrayBufferLike> | BatchId | EnvelopeWithBatchId

data

Raw chunk to be uploaded (Content Addressed Chunk or Single Owner Chunk)

Uint8Array<ArrayBufferLike> | Chunk | SingleOwnerChunk

options?

UploadOptions

Additional options like tag, encryption, pinning, content-type and request options

requestOptions?

BeeRequestOptions

Options for making requests, such as timeouts, custom HTTP agents, headers, etc.

Returns

Promise<UploadResult>

💬 Get Help