concat-stream
concat-stream copied to clipboard
concat-stream - buffer object in callback is empty.
See the following piece of code.
var concat = require('concat-stream');
var src = // some stream which contains non-utf-8 content for ex : shift_jis
var dest = // it is destination stream
var concatStream = concat(function(buffer)) {
// buffer is empty string here. It is not readable while debugging as well.
// I want to do some modifications in this buffer.
dest.write(buffer);
dest.close();
}
On browser I see response is coming back but none of the modifications were made to the content. If I try to debug buffer is empty string in callback.
you have to do src.pipe(concatStream). Also I am not sure what dest is in your example, concatStream should be the destination
Yes I missed mentioning I am doing src.pipe(concatStream) . dest is some other final stream or destination where I want to write the data back,
Oh I see. It seems your code should be working, without a test case that reproduces the problem I am not sure I can help any further.
Thanks. Will get back to you with a test code.