diff --git a/pandoc.js b/pandoc.js index ac92861..eddf173 100644 --- a/pandoc.js +++ b/pandoc.js @@ -112,9 +112,12 @@ exports.convert = function(type, input, types, callback) { //so that we have the target type in scope on('data') - love ya some asynch pandoc.stdout.targetType = types[i]; + // Data may be batched. Ensure an empty placeholder is available for incremental collection. + res[types[i]] = ''; + pandoc.stdout.on('data', function(data) { //data will be a binary stream if you don't cast it to a string - res[this.targetType] = data + ''; + res[this.targetType] += data + ''; }); pandoc.on('error', function(err) {