node-ctypes - v2.10.0
    Preparing search index...

    Function readValue

    • Read a typed value from a buffer at a given offset.

      Type Parameters

      Parameters

      • ptr: MemorySource

        Buffer to read from

      • type: T

        Type to read (e.g. c_int32, c_double)

      • Optionaloffset: number

        Byte offset (default 0)

      Returns JsFromCType<T>

      const buf = Buffer.alloc(8);
      buf.writeInt32LE(42, 0);
      console.log(readValue(buf, c_int32)); // 42
    • Read a typed value from a buffer at a given offset.

      Parameters

      Returns any

      const buf = Buffer.alloc(8);
      buf.writeInt32LE(42, 0);
      console.log(readValue(buf, c_int32)); // 42