Hello. I'm new in nodejs and now playing with streams. Now I try combine streams in one and then separate their. For separate used Transform stream. When i try call "done" callback in _read method of separate Readable stream - throw Exception.
Error: no writecb in Transform class at afterTransform (_stream_transform.js:92:33) at TransformState.afterTransform (_stream_transform.js:76:12) Thanks for help. function separateStreams(options) { var idx = 0; var streams = []; function Divider(options) { Transform.call(this, options); } Divider.prototype = Object.create( Transform.prototype, { constructor: { value: Divider }}); Divider.prototype._transform = function(chunk, encoding, done) { var length = chunk.length, split = -1, buf; for (var i = 0; i < length; i++) { if (chunk[i] === 10) { // '\n' if ((i + 3) < length && chunk[i+1] === 10 && chunk[i+2] == '93' && chunk[i+3] == '93') { split = i; break; } } } var self = this, rs; if (!streams[idx]) { rs = new Readable; rs._read = function() { done(); //Error: no writecb in Transform class }; this.emit('stream', rs, idx); streams.push(rs); } else { rs = streams[idx]; } if (chunk === null) return rs.push(null); if (split == -1) { rs.push(chunk); } else { rs.push(chunk.slice(0, split)); rs.push(null); idx++; this.unshift(chunk.slice(split + 4)); } }; return new Divider(options); } rs.pipe(separateStreams).on('stream', function(stream) { ws.pipe(stream); }); -- -- Job Board: http://jobs.nodejs.org/ Posting guidelines: 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 post to this group, send email to nodejs@googlegroups.com To unsubscribe from this group, send email to nodejs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en --- 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 nodejs+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.