Sunday, 18 February 2018

The lack of streaming templates

The mean reason I love node.js is it's async nature. You are forced to write async code all the time, which is huge benefit. I have always used JSON APIs to write my server side code and streamed the JSON result. This time I need to write a HTML API, which may produce thousands of rows with identical markup. There is no option to add pagination. I've checked that only the data I want to process uses 100 MB of node.js RAM (not the data itself), so it's ideal candidate for a stream.I've done my research and found a single template engine, that supports stream parameters - LinkedIn's https://dustjs.com, which haven't been updated since 2016. Am I missing something? Why there aren't more template engines that support stream parameters? Even the python's flask template Jinja2 supports streams. I thought of a workaround - to split my template files to smaller chunks and stream them manually, but it's ugly solution. Any help will be appreciated!

Submitted February 19, 2018 at 12:17AM by suricactus

No comments:

Post a Comment