Skip to content

Instantly share code, notes, and snippets.

@mlopez0987
Last active January 1, 2026 09:34
Show Gist options
  • Select an option

  • Save mlopez0987/52e20a1e9d250f37f17b to your computer and use it in GitHub Desktop.

Select an option

Save mlopez0987/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));
}
@mlopez0987
Copy link
Author

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