-
-
Save bmeck/8091494c50d4d820ba5c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Buffer = exports.Buffer = exports.SlowBuffer = function(v, encoding) | |
{ | |
var offset = 0; | |
if (v instanceof ArrayBuffer) | |
Uint8ClampedArray.call(this, v, offset) | |
} | |
Buffer.prototype = Object.create(Uint8ClampedArray.prototype); | |
Buffer.prototype.TEST = 'TEST ON OBJECT FROM PROTOTYPE'; | |
var x = (new Buffer(new ArrayBuffer(12))) | |
x[1] = 123; | |
x[2] = 456; | |
console.log('is Buffer: %s, is Uint8Array: %s', x instanceof Buffer, x instanceof Uint8Array); | |
console.log('x: %s, x.TEST: %s, x[0]: %s, x[1]: %s, x[2]: %s', x, x.TEST, x[0], x[1], x[2]); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment