Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/deno/cli/tsc/dts/lib.deno.ns.d.ts>Deno.UnsafePointerView

A modern runtime for JavaScript and TypeScript.
Latest
class Deno.UnsafePointerView
import { Deno } from "https://deno.land/x/deno@v2.0.4/cli/tsc/dts/lib.deno.ns.d.ts";
const { UnsafePointerView } = Deno;

An unsafe pointer view to a memory location as specified by the pointer value. The UnsafePointerView API follows the standard built in interface DataView for accessing the underlying types at an memory location (numbers, strings and raw bytes).

Constructors

new
UnsafePointerView(pointer: PointerObject)

Methods

copyInto(destination: BufferSource, offset?: number): void

Copies the memory of the pointer into a typed array.

Length is determined from the typed array's byteLength.

Also takes optional byte offset from the pointer.

getArrayBuffer(byteLength: number, offset?: number): ArrayBuffer

Gets an ArrayBuffer of length byteLength at the specified byte offset from the pointer.

getBigInt64(offset?: number): bigint

Gets a signed 64-bit integer at the specified byte offset from the pointer.

getBigUint64(offset?: number): bigint

Gets an unsigned 64-bit integer at the specified byte offset from the pointer.

getBool(offset?: number): boolean

Gets a boolean at the specified byte offset from the pointer.

getCString(offset?: number): string

Gets a C string (null terminated string) at the specified byte offset from the pointer.

getFloat32(offset?: number): number

Gets a signed 32-bit float at the specified byte offset from the pointer.

getFloat64(offset?: number): number

Gets a signed 64-bit float at the specified byte offset from the pointer.

getInt16(offset?: number): number

Gets a signed 16-bit integer at the specified byte offset from the pointer.

getInt32(offset?: number): number

Gets a signed 32-bit integer at the specified byte offset from the pointer.

getInt8(offset?: number): number

Gets a signed 8-bit integer at the specified byte offset from the pointer.

getPointer<T = unknown>(offset?: number): PointerValue<T>

Gets a pointer at the specified byte offset from the pointer

getUint16(offset?: number): number

Gets an unsigned 16-bit integer at the specified byte offset from the pointer.

getUint32(offset?: number): number

Gets an unsigned 32-bit integer at the specified byte offset from the pointer.

getUint8(offset?: number): number

Gets an unsigned 8-bit integer at the specified byte offset from the pointer.

Static Methods

copyInto(
pointer: PointerObject,
destination: BufferSource,
offset?: number,
): void

Copies the memory of the specified pointer into a typed array.

Length is determined from the typed array's byteLength.

Also takes optional byte offset from the pointer.

getArrayBuffer(
pointer: PointerObject,
byteLength: number,
offset?: number,
): ArrayBuffer

Gets an ArrayBuffer of length byteLength at the specified byte offset from the specified pointer.

getCString(pointer: PointerObject, offset?: number): string

Gets a C string (null terminated string) at the specified byte offset from the specified pointer.