Skip to content

Ascii

Defined in: astrobase/src/ascii/ascii.ts:20

Parses a NUL terminated ASCII string within binary.

import { Ascii } from '@astrobase/sdk/ascii';
const bytes = [72, 101, 108, 108, 111, 0];
const offset = 0;
const ascii = new Ascii(bytes, offset);
console.log(ascii.value); // 'Hello'
console.log(ascii.encodingEnd); // 5

new Ascii(buffer, encodingStart): Ascii

Defined in: astrobase/src/ascii/ascii.ts:23

The binary containing the ASCII string.

ArrayBufferLike | ArrayLike<number>

number = 0

The byte index where the ASCII string begins. Defaults to the start of the buffer.

Ascii

readonly encodingStart: number = 0

Defined in: astrobase/src/ascii/ascii.ts:27

The byte index where the ASCII string begins. Defaults to the start of the buffer.

get encodingEnd(): number

Defined in: astrobase/src/ascii/ascii.ts:37

The byte index of the NUL terminator byte.

RangeError if the end of the buffer was reached without finding the terminator.

number


get value(): string

Defined in: astrobase/src/ascii/ascii.ts:51

The ASCII encoded value as a string.

RangeError if the end of the buffer was reached without finding the terminator.

string