Created
March 15, 2011 19:38
-
-
Save KOBA789/871297 to your computer and use it in GitHub Desktop.
NodeのBufferを連結する何か
This file contains hidden or 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 buf1 = new Buffer([0xe3, 0x81]); | |
| var buf2 = new Buffer([0x82, 0xe3, 0x81, 0x84]) | |
| Buffer.prototype.push = function (buf) { | |
| var newBuf = new Buffer(this.length + buf.length); | |
| this.copy(newBuf); | |
| buf.copy(newBuf, this.length); | |
| return newBuf; | |
| } | |
| console.log(buf1.push(buf2)); | |
| console.log(buf1.push(buf2).toString()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment