Title: How to inherit from new Buffer implementation · Issue #2882 · nodejs/node · GitHub
Open Graph Title: How to inherit from new Buffer implementation · Issue #2882 · nodejs/node
X Title: How to inherit from new Buffer implementation · Issue #2882 · nodejs/node
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...
Open Graph 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 classi...
X 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 cl...
Opengraph URL: https://github.com/nodejs/node/issues/2882
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"How to inherit from new Buffer implementation","articleBody":"Hi,\nI would like to know how a class could inherit from the new Buffer implementation.\n\nI'm trying to upgrade the [node-ogg module](https://github.com/TooTallNate/node-ogg) for node v4 and nan v2.\n([Here is my work so far](https://github.com/corentingurtner/node-ogg/tree/upgrade-nan))\n\nI tried this classic inheritance model: \n\n``` javascript\nfunction ogg_packet (buffer) {\n if (!Buffer.isBuffer(buffer)) {\n Buffer.call(this, binding.sizeof_ogg_packet);\n } else {\n Buffer.call(this, buffer);\n }\n if (this.length != binding.sizeof_ogg_packet) {\n throw new Error('\"buffer.length\" = ' + this.length + ', expected ' + binding.sizeof_ogg_packet);\n }\n}\ninherits(ogg_packet, Buffer);\n```\n\nBut I get this error when trying to access _this.length_ : \n\n```\nUncaught TypeError: Method Uint8Array.length called on incompatible receiver [object Object]\n```\n\nThanks\n\nNote: I also asked the question on SO:\nhttp://stackoverflow.com/questions/32555714\n","author":{"url":"https://github.com/corentingurtner","@type":"Person","name":"corentingurtner"},"datePublished":"2015-09-15T17:33:11.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":18},"url":"https://github.com/2882/node/issues/2882"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:a135fc37-e881-3054-5cdd-255f21a0b9a1 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | C1CA:31A9ED:424BC:5E25A:6A4DB86B |
| html-safe-nonce | c97c2be699e3db72e6e43fa2340c2623996629faa6a4b0dcc98d617be7589304 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDMUNBOjMxQTlFRDo0MjRCQzo1RTI1QTo2QTREQjg2QiIsInZpc2l0b3JfaWQiOiI4MzQyNTQ0NDk5MDA4NzE0ODU5IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 1f88c0401872d212655fa1f650ed06934f8df6e5cfb5890c1fb6d8b1f90e8e6f |
| hovercard-subject-tag | issue:106606246 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/nodejs/node/2882/issue_layout |
| twitter:image | https://opengraph.githubassets.com/41b71709fcb4618fbd676b3ecc43927ac69da5da748bec4ca885541ca1a40e6a/nodejs/node/issues/2882 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/41b71709fcb4618fbd676b3ecc43927ac69da5da748bec4ca885541ca1a40e6a/nodejs/node/issues/2882 |
| og:image:alt | 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 classi... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | corentingurtner |
| hostname | github.com |
| expected-hostname | github.com |
| None | 06b8a6144231bf3a234f1c2e9993861e07ce98a905912b114aa386c2d7e84b33 |
| turbo-cache-control | no-preview |
| go-import | github.com/nodejs/node git https://github.com/nodejs/node.git |
| octolytics-dimension-user_id | 9950313 |
| octolytics-dimension-user_login | nodejs |
| octolytics-dimension-repository_id | 27193779 |
| octolytics-dimension-repository_nwo | nodejs/node |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 27193779 |
| octolytics-dimension-repository_network_root_nwo | nodejs/node |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 32f7b614aca06e6bbd89842b1370df1328264f68 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width