This could be moved into a header and shared with src/node_buffer.cc and src/string_bytes.cc.