Guest User

Untitled

a guest
Jul 20th, 2018
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.32 KB | None | 0 0
  1. Buffer.prototype.append = function(buf) {
  2. var newBuf = new Buffer(this.length + buf.length);
  3. this.copy(newBuf, 0, 0);
  4. if (Buffer.isBuffer(buf))
  5. buf.copy(newBuf, this.length, 0);
  6. else if (Array.isArray(buf)) {
  7. for (var i=this.length, len=buf.length; i<len; i++)
  8. newBuf[i] = buf[i];
  9. }
  10.  
  11. return newBuf;
  12. };
Add Comment
Please, Sign In to add comment