Closed tahirakhter closed 4 years ago
what should we use here. how should we add stream pipeline
jsreport does not support receiving data as stream input, and it does not support it not because we don't want to.. it is more because the template evaluation limitations (limitation of template engines like handlebars, etc), it needs to have the whole data in object in order to make the data replacement in the template, there is no data stream flow support on those template engines so even if we accept that you pass an stream we'll still need to read and concat the data of the stream and put it in an object before the template evaluation starts.
you can use something like concat-stream for collecting the data in the stream before calling render.
i will let the issue open in case @pofider wants to add some comments about accepting data as stream (but as i said we will still need to read the whole stream before starting to render, adding support for the stream will be just for convenience)
Yes, it is the limitation of the templating engines we use. We had already a discussion about this before releasing v2 and it ended up that we can't support streams so far.
Maybe you just need to do a better data projection to limit data size.
Closing. Evaluating streams isn't technically possible. Even if jsreport uses just streams in its internal, in the end, there are other dependencies that need to load everything to the memory.
we are using axios to read large data from an API server as JSON stream as below:
below is our jsreport.render function