Using electron I am trying to write out some bytes on a TCP socket. I am 
using Buffer.from to convert to buffer before calling write, but am still 
getting the above error. I have simplified it down to just creating an 
empty ArrayBuffer and calling Buffer.from


var abuff = new ArrayBuffer(8 + encodedBuffer.length);
console.log(Buffer.from(abuff));
socket.write(Buffer.from(abuff));


TypeError: Invalid data, chunk must be a string or buffer, not object at 
Socket.write (net.js:667:11)


The console.log shows the following:

Uint8Array(51) [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
0, 0, 0, 0]

and not Buffer?


Why would Buffer.from not create a Buffer?


Versions in electron: 

ares:"1.10.1-DEV" 

atom-shell:"1.7.9" 

chrome:"58.0.3029.110" 

electron:"1.7.9" 

http_parser:"2.7.0" 

modules:"54" 

node:"7.9.0" 

openssl:"1.0.2k" 

uv:"1.11.0" 

v8:"5.8.283.38" 

zlib:"1.2.11"

-- 
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/33bc035f-8074-4cc8-8d14-b0603570db7a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to