Mochabot log - CommonJS IRC channel: #commonjs on irc.freenode.net

2009-12-29:

[1:41] <tlrobinson1> what would the best way to read a stream until a certain byte (e.x. EOT) be?
[1:42] <ashb> in terms of API?
[1:42] <tlrobinson1> sitting in a JavaScript while loop reading one character at a time seems inefficient
[1:42] <tlrobinson1> given the APIs proposed so far
[1:42] <ashb> ah. kind of does
[1:42] <ashb> http://www.boost.org/doc/libs/1_37_0/doc/html/boost_asio/reference/async_read_until/overload1.html
[1:43] <ashb> (jump to the end. there is am atching sync version)
[1:43] <ashb> something like that perhaps?
[1:43] <tlrobinson1> yea
[1:43] <tlrobinson1> that would be good for readLine, etc
[1:43] <tlrobinson1> though i guess there are multiple line endings :-/
[1:43] <ashb> eof is a special case of that i guess
[1:44] <ashb> could make it a regexp without adding too much complexity
[1:45] <ashb> also actualy reading a byte at time would be silly - it would probably make sense to buffer it even if you return it byte at a time to JS
[1:45] <tlrobinson1> EOT = 0x04 and is different than "EOF"
[1:46] <ashb> EOT? that one of those wierd control chars?
[1:46] <tlrobinson1> yeah apparently
[1:46] <tlrobinson1> i don't know much about it
[1:46] <ashb> ah ASCII - what a wonderful legacy
[1:46] <ashb> i'd have some special fale for EOF that isn't a number
[1:46] <ashb> stream.readUntil(-1) etc or something
[1:47] <tlrobinson1> basically i want to delimit a stream of text
[1:47] <ashb> read it in 4k at a time and split?
[1:47] <tlrobinson1> i don't want to close the stream between each
[1:49] <tlrobinson1> yeah i guess that would be better
[1:54] <tlrobinson1> i suppose i should really just use a length prefixed string

 

 

Logs by date :