node.js - Buffer Octet Stream in NodeJs -


i novice in nodejs , have read buffer not clear.

some examples:-

1) var buffer = new buffer(12); 2) var buffer = new buffer([12,54,89]); 3) var buffer = new buffer("confusing buffer", "utf-8"); 

here queries are,

  • what buffer , way define/implement.
  • what meaning of above examples.

in javascript, strings not binary safe. there characters illegal in strings.

this of course makes difficult process binary data such images or mp3 files since i/o in javascript deal strings.

the solution node developers implemented buffers. think of buffers strings binary data (and remember, text subset of binary data).

as specific questions, answer second question answers first question: the example code posted examples of how define buffers.


Comments

Popular posts from this blog

java - UnknownEntityTypeException: Unable to locate persister (Hibernate 5.0) -

python - ValueError: empty vocabulary; perhaps the documents only contain stop words -

ubuntu - collect2: fatal error: ld terminated with signal 9 [Killed] -