Skip to content

bytes

@algorandfoundation/algorand-typescript


@algorandfoundation/algorand-typescript / index / bytes

Type Alias: bytes

bytes: object

Defined in: packages/algo-ts/src/primitives.ts:101

A sequence of zero or more bytes (ie. byte[])

Type declaration

length

readonly length: uint64

Retrieve the length of the byte sequence

at()

Retrieve the byte at the index i

Parameters

i

Uint64Compat

The index to read. Can be negative to read from the end

Returns

bytes

The byte found at the index, or an empty bytes value

bitwiseAnd()

Perform a bitwise AND operation with this bytes value and another bytes value.

The shorter of the two values will be zero-left extended to the larger length.

Parameters

other

BytesCompat

The other bytes value

Returns

bytes

The bitwise operation result

bitwiseInvert()

Perform a bitwise INVERT operation with this bytes value

Returns

bytes

The bitwise operation result

bitwiseOr()

Perform a bitwise OR operation with this bytes value and another bytes value

The shorter of the two values will be zero-left extended to the larger length.

Parameters

other

BytesCompat

The other bytes value

Returns

bytes

The bitwise operation result

bitwiseXor()

Perform a bitwise XOR operation with this bytes value and another bytes value.

The shorter of the two values will be zero-left extended to the larger length.

Parameters

other

BytesCompat

The other bytes value

Returns

bytes

The bitwise operation result

concat()

Concatenate this bytes value with another bytes value

Parameters

other

BytesCompat

The other bytes value

Returns

bytes

The concatenation result

equals()

Compares this bytes value with another.

Parameters

other

BytesCompat

The other bytes value

Returns

boolean

True if both values represent the same byte sequence

slice()

Call Signature

Returns a copy of this bytes sequence

Returns

bytes

Call Signature

Returns a slice of this bytes sequence from the specified start to the end

Parameters
start

Uint64Compat

The index to start slicing from. Can be negative to count from the end.

Returns

bytes

Call Signature

Returns a slice of this bytes sequence from the specified start to the specified end

Parameters
start

Uint64Compat

The index to start slicing from. Can be negative to count from the end.

end

Uint64Compat

The index to end the slice. Can be negative to count from the end.

Returns

bytes

toString()

Interpret this byte sequence as a utf-8 string

Returns

string