Skip to content

Instantly share code, notes, and snippets.

@L2L2L
Last active August 29, 2015 14:05
Show Gist options
  • Save L2L2L/52e20a1e9d250f37f17b to your computer and use it in GitHub Desktop.
Save L2L2L/52e20a1e9d250f37f17b to your computer and use it in GitHub Desktop.
Replacement for all write and read method for Buffer's instance objects.
"Use strict";
Buffer.prototype.read = function(index, dataType, offfset, end){
offset = offset||0;
end = end||this.length;
return (this["read"+dataType](index, offset, end));
}
Buffer.prototype.write = function(index, dataType, offfset, end){
offset = offset||0;
end = end||this.length;
return (this["write"+dataType](index, offset, end));
}
@L2L2L
Copy link
Author

L2L2L commented Aug 30, 2014

I aim to contribute to node through C/C++ add-on. This is one of the things I will create an add on for to hard code it in node.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment