Skip to main content

Module typedarray

Module typedarray 

Source
Expand description

JavaScript typed arrays (Uint8Array/Int8Array/…/Float64Array), ArrayBuffer, WeakRef, and TextEncoder/TextDecoder.

A typed array is a plain object tagged @@native = "TypedArray" carrying its kind (@@kind), its elements as a hidden @@elems array of numbers, and the enumerable length/byteLength/BYTES_PER_ELEMENT data properties JS code reads directly. Element indexing (ta[i] get/set) is special-cased in builtins::get_property/set_property via elem_get/elem_set here, which also apply each kind’s coercion (integer wrap / clamp / float).

WeakRef holds a strong reference (deref() always returns the target) — node-js has no GC of JS objects, so this is observably correct for the express dependency tree (object-inspect/qs/side-channel only ever deref()).

Constants§

STATIC_METHODS

Functions§

construct
new Uint8Array(...) etc. ArrayBuffer is a byte container with only a byteLength.
construct_finalization_registry
construct_text_decoder
construct_text_encoder
construct_weakref
elem_get
ta[i] read: the element at char/index i, or None if i is out of range or not an integer index.
elem_set
ta[i] = v write (coerced to the kind). Returns true if i is a valid index.
finalization_registry_call
instance_call
Typed-array instance methods.
is_ctor
The nine element kinds plus ArrayBuffer (which carries only a byte length).
static_call
Uint8Array.from(iterable[, mapFn]) / Uint8Array.of(...items).
text_decoder_call
text_encoder_call
weakref_call