Keats/tera

Can I use file output stream instead of write?

Closed this issue · 2 comments

I want to use tera to render a very large word, perhaps with thousands of pages, but the current implementation seems to put it in memory first.

I want to use file stream instead of write here, and then output the rendered results to the file. Is this feasible?

    /// Entry point for the rendering
    pub fn render(&mut self, write: &mut impl Write) -> Result<()> {
        for node in &self.template_root.ast {
            self.render_node(node, write)
                .map_err(|e| Error::chain(self.get_error_location(), e))?;
        }

        Ok(())
    }

Thank you very much, I'll try it later