Open sehrgut opened 11 years ago
This appears to have something to do with the relationship between how join
is triggered, and how lines
emits its final buffer. Here's a bit of sample code, and its output:
var Lazy = require('./lazy');
var l = new Lazy();
l.lines.join(function (x) { console.log(x); });
l.emit('data', 'abcdef');
l.emit('end');
I put logging lines at various points, which you'll see.
pushing last line
bucket emitting pipe event
join received pipe event
[]
bucket yielding final buffer on end event: "abcdef"
Those logging lines are:
lines
pushing the last bit of databucket
receiving and delegating the "pipe" event to its internal Lazyjoin
receiving the "pipe" event from bucket
and calling its callbackbucket
getting the "end" event and yielding the final buffer, too late for join
, and the contents of that buffer.I hope this is helpful in resolving the issue. I wasn't able to figure out a satisfactory solution myself.
Expected output:
Actual output: