-
Notifications
You must be signed in to change notification settings - Fork 505
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for node::Encode/DecodeBytes/DecodeWrite. #251
Conversation
@@ -1816,6 +1816,45 @@ namespace Nan { | |||
enum Encoding {ASCII, UTF8, BASE64, UCS2, BINARY, HEX, BUFFER}; | |||
} | |||
|
|||
NAN_INLINE v8::Local<v8::Value> NanEncode(const void *buf, size_t len, enum Nan::Encoding encoding = Nan::BINARY) { |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
The DecodeBytes() and DecodeWrite() calls that transpose BUFFER to BINARY work but perhaps it's clearer to call the corresponding Buffer methods directly. |
I did that first, but changed to this after I noticed the code paths would become identical as it felt cleaner and does not perform the same sanity checks twice. Otherwise I need to replicate a bunch of error checking (val is not, array, because 'raw' encoding is no longer supported) and other edge cases, which makes it grow more than one might first think. |
6caf664
to
cfc4a08
Compare
Should be fixed now. |
Fixes #250.