Templating engines don't work in the stream way and require to have all data in the memory.

You can, however, read partial data step by step using beforeRender script and aggregate (throw away what you don't need).