Skip to content

Instantly share code, notes, and snippets.

/*
* Based off of http://sambro.is-super-awesome.com/2011/03/03/creating-a-proper-buffer-in-a-node-c-addon/
*/
static Local<Object> makeBuffer(char* data, size_t size) {
HandleScope scope;
// It ends up being kind of a pain to convert a slow buffer into a fast
// one since the fast part is implemented in JavaScript.
Local<Buffer> slowBuffer = Buffer::New(data, size);
// First get the Buffer from global scope...