Dynamic module ref-array

Index

Variables

Variables

ArrayType: ArrayType

The array type meta-constructor. The returned constructor's API is highly influenced by the WebGL TypedArray API.

(length?: number): { length: number; toArray(): T[]; toJSON(): T[]; inspect(): string; buffer: Buffer; ref(): Buffer; [i: number]: T; }

Parameters

  • length?: number optional

Returns

{ length: number; toArray(): T[]; toJSON(): T[]; inspect(): string; buffer: Buffer; ref(): Buffer; [i: number]: T; }

(data: Array<number>, length?: number): { length: number; toArray(): T[]; toJSON(): T[]; inspect(): string; buffer: Buffer; ref(): Buffer; [i: number]: T; }

Parameters

  • data: Array<number>
  • length?: number optional

Returns

{ length: number; toArray(): T[]; toJSON(): T[]; inspect(): string; buffer: Buffer; ref(): Buffer; [i: number]: T; }

(data: Buffer, length?: number): { length: number; toArray(): T[]; toJSON(): T[]; inspect(): string; buffer: Buffer; ref(): Buffer; [i: number]: T; }

Parameters

  • data: Buffer
  • length?: number optional

Returns

{ length: number; toArray(): T[]; toJSON(): T[]; inspect(): string; buffer: Buffer; ref(): Buffer; [i: number]: T; }

constructor(length?: number): { length: number; toArray(): T[]; toJSON(): T[]; inspect(): string; buffer: Buffer; ref(): Buffer; [i: number]: T; }

Parameters

  • length?: number optional

Returns

{ length: number; toArray(): T[]; toJSON(): T[]; inspect(): string; buffer: Buffer; ref(): Buffer; [i: number]: T; }

constructor(data: Array<number>, length?: number): { length: number; toArray(): T[]; toJSON(): T[]; inspect(): string; buffer: Buffer; ref(): Buffer; [i: number]: T; }

Parameters

  • data: Array<number>
  • length?: number optional

Returns

{ length: number; toArray(): T[]; toJSON(): T[]; inspect(): string; buffer: Buffer; ref(): Buffer; [i: number]: T; }

constructor(data: Buffer, length?: number): { length: number; toArray(): T[]; toJSON(): T[]; inspect(): string; buffer: Buffer; ref(): Buffer; [i: number]: T; }

Parameters

  • data: Buffer
  • length?: number optional

Returns

{ length: number; toArray(): T[]; toJSON(): T[]; inspect(): string; buffer: Buffer; ref(): Buffer; [i: number]: T; }

public BYTES_PER_ELEMENT: number

optional public alignment?: number

The alignment of this datatype when placed inside a struct.

public fixedLength: number

public indirection: number

The current level of indirection of the buffer.

optional public name?: string

The name to use during debugging for this datatype.

public size: number

The size in bytes required to hold this datatype.

public type: Type

The reference to the base type.

public get(buffer: Buffer, offset: number): any

To invoke when ref.get is invoked on a buffer of this type.

Parameters

  • buffer: Buffer
  • offset: number

Returns

any

public set(buffer: Buffer, offset: number, value: any)

To invoke when ref.set is invoked on a buffer of this type.

Parameters

  • buffer: Buffer
  • offset: number
  • value: any

public untilZeros(buffer: Buffer): { length: number; toArray(): T[]; toJSON(): T[]; inspect(): string; buffer: Buffer; ref(): Buffer; [i: number]: T; }

Accepts a Buffer instance that should be an already-populated with data for the ArrayType. The "length" of the Array is determined by searching through the buffer's contents until an aligned NULL pointer is encountered.

Parameters

Returns

{ length: number; toArray(): T[]; toJSON(): T[]; inspect(): string; buffer: Buffer; ref(): Buffer; [i: number]: T; }