Skip to content

Buffer api for conversion from/to ArrayBuffer #535

Description

@kyriosli

Js side conversion (like new Uint8Array(buffer) or new Buffer(bufferView)) is really slow cause it treats input as an integer array rather than a pointer to a memory address.

In older version of node.js which is compiled with v8 that does not support ArrayBuffer, ArrayBufferViews are constructed with node's Buffer, so there is no such problem.

Could we afford a new api like:

    var buf = new Buffer(1<<28);
    var arrBuf = buf.toArrayBuffer();
    var buf2 = Buffer.fromArrayBuffer(arrBuf);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions