4 ms·
Binary Stream Parsing in Node.js
- modeless 16y agoHandling binary data in Javascript will soon get a lot better with the new Typed Arrays spec: http://people.mozilla.com/~vladimir/jsvec/TypedArray-spec.html http://people.mozilla.com/~vladimir/jsvec/TypedArray-spec.ht... It was invented for WebGL but is already being used by the guys doing raw audio APIs and will hopefully see wide adoption wherever binary data is found (2D Canvas, sockets, XMLHttpRequest, Web Workers, storage, local file access).
- dhotson 16y agoGood stuff! I was thinking about implementing a SPDY server in Node the other week, but I couldn't figure out a good way to do the binary framing part. This looks highly useful.
- felixge 16y agoVery interesting approach. Is this already taking care of releasing buffers after they've been tap'ed into?
- substack 16y agoWhen advance() in BufferList gets called, the linked list of buffers behind the scene advances so that all the unused buffers can get garbage collected. Binary has a flush() method too that calls advance().
- felixge 16y agoNice, I'll definitely take this lib on my next binary adventure : )