thanks Ben, 

I found setting up the addon quite straightforward but all the type 
conversions of the javascript inputs to c++ and c++ outputs to v8 was the 
tricky bit. 

On Saturday, March 19, 2016 at 6:35:17 AM UTC, Ben Noordhuis wrote:
>
> On Wed, Mar 16, 2016 at 9:59 PM, HungryHippo 
> <[email protected] <javascript:>> wrote: 
> > hi, i'm really struggling to work with Nan and conversions of C++ to V8 
> > types. 
> > 
> > How would i convert this format ?  std::vector<uint8_t> data; 
> > 
> > 
> > info.GetReturnValue().Set(Nan::New<v8::String>(convertedData)); 
> > 
> > 
> > thanks for any help :-) 
>
> if (data.empty()) { 
>   info.GetReturnValue().SetEmptyString(); 
> } else { 
>   // Assumes |data| contains valid UTF-8. 
>   const char* chars = reinterpret_cast<const char*>(&data[0]); 
>   info.GetReturnValue().Set(Nan::New(chars, 
> data.size()).ToLocalChecked()); 
> } 
>

-- 
Job board: http://jobs.nodejs.org/
New group rules: 
https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
--- 
You received this message because you are subscribed to the Google Groups 
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/nodejs/3992f4fe-a2dc-4606-8598-bacc77cd1121%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to