-
-
Notifications
You must be signed in to change notification settings - Fork 32.5k
Closed
Labels
bufferIssues and PRs related to the buffer subsystem.Issues and PRs related to the buffer subsystem.docIssues and PRs related to the documentations.Issues and PRs related to the documentations.questionIssues that look for answers.Issues that look for answers.
Description
Hi,
I would like to know how a class could inherit from the new Buffer implementation.
I'm trying to upgrade the node-ogg module for node v4 and nan v2.
(Here is my work so far)
I tried this classic inheritance model:
function ogg_packet (buffer) {
if (!Buffer.isBuffer(buffer)) {
Buffer.call(this, binding.sizeof_ogg_packet);
} else {
Buffer.call(this, buffer);
}
if (this.length != binding.sizeof_ogg_packet) {
throw new Error('"buffer.length" = ' + this.length + ', expected ' + binding.sizeof_ogg_packet);
}
}
inherits(ogg_packet, Buffer);
But I get this error when trying to access this.length :
Uncaught TypeError: Method Uint8Array.length called on incompatible receiver [object Object]
Thanks
Note: I also asked the question on SO:
http://stackoverflow.com/questions/32555714
Metadata
Metadata
Assignees
Labels
bufferIssues and PRs related to the buffer subsystem.Issues and PRs related to the buffer subsystem.docIssues and PRs related to the documentations.Issues and PRs related to the documentations.questionIssues that look for answers.Issues that look for answers.