Ascii
Defined in: astrobase/src/ascii/ascii.ts:20
Parses a NUL terminated ASCII string within binary.
Example
Section titled “Example”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); // 5Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new Ascii(
buffer,encodingStart):Ascii
Defined in: astrobase/src/ascii/ascii.ts:23
Parameters
Section titled “Parameters”buffer
Section titled “buffer”The binary containing the ASCII string.
ArrayBufferLike | ArrayLike<number>
encodingStart
Section titled “encodingStart”number = 0
The byte index where the ASCII string begins. Defaults to the start of the buffer.
Returns
Section titled “Returns”Ascii
Properties
Section titled “Properties”encodingStart
Section titled “encodingStart”
readonlyencodingStart: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.
Accessors
Section titled “Accessors”encodingEnd
Section titled “encodingEnd”Get Signature
Section titled “Get Signature”get encodingEnd():
number
Defined in: astrobase/src/ascii/ascii.ts:37
The byte index of the NUL terminator byte.
Throws
Section titled “Throws”RangeError if the end of the buffer was reached without finding the terminator.
Returns
Section titled “Returns”number
Get Signature
Section titled “Get Signature”get value():
string
Defined in: astrobase/src/ascii/ascii.ts:51
The ASCII encoded value as a string.
Throws
Section titled “Throws”RangeError if the end of the buffer was reached without finding the terminator.
Returns
Section titled “Returns”string