Skip to content

stringToPayload(data): Uint8Array

Defined in: src/utils/payload.ts:32

A string as an entity payload, encoded as UTF-8.

Hex-looking text is encoded as text: stringToPayload("0xab") gives the four bytes of that string, not the single byte 0xab. Read it back with entity.toText().

string

Uint8Array

await client.createEntity({
payload: stringToPayload("hello"),
contentType: "text/plain",
expires: ExpirationTime.fromDays(30),
})