pgriess / node-strtok

A streaming tokenizer library for NodeJS

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Need ability to recover remaining bytes on DONE

pgriess opened this issue · comments

Some protocols may wish to own processing of stream bytes after doing some initial processing with strtok. At this point, the protocol can lose data because strtok.parse() does not expose the remaining buffers that have not yet been consumed.

To fix this, once the protocol callback returns DONE, strtok.parse() should synthesize data events on the stream and push out the yet-to-be-consumed Buffer instances. The assumption here is that the protocol layer will have set up data handlers if it wishes to see these events.

Emit remaining buffers on DONE.

Closed by 928ad06.