FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Buffer created using new Buffer(buffer) has a different ArrayBuffer from the original one · Issue #4341 · nodejs/node · GitHub

/ node Public

Buffer created using new Buffer(buffer) has a different ArrayBuffer from the original one #4341

Description

Hope the title describes the issue correctly:)

Codes:

var typed_array = new Uint8Array(6);
for(var i = 0; i < typed_array.length; i++){
  typed_array[i] = i;
}

var array_buffer = typed_array.buffer;
console.log("byteLength of ArrayBuffer : " + array_buffer.byteLength);

var node_buffer = new Buffer(array_buffer);
console.log("Node Buffer : ");
console.log(node_buffer);

console.log("byteLength of ArrayBuffer in Node Buffer : ", node_buffer.buffer.byteLength);

var another_node_buffer = new Buffer(node_buffer);
console.log("Another Node Buffer : ");
console.log(another_node_buffer);

console.log("byteLength of ArrayBuffer in Another Node Buffer : ", another_node_buffer.buffer.byteLength);

node_buffer.buffer is different from another_node_buffer.buffer !

Metadata

Metadata

Assignees

Labels

bufferIssues and PRs related to the buffer subsystem.docIssues and PRs related to Node.js documentation.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions


Back | FazBrowse Home | New Git URL