Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
48 lines (29 sloc) 1.06 KB

Δt Stream Adapter

This is a stream adapter for Δt.


$ npm install dt-stream


var Template = require('dynamictemplate').Template;
var streamify = require('dt-stream');

var template = streamify(new Template({schema:5, pretty:true}, function () {
    this.$html(function () {
        this.$body("hello world");

/* → stdout:
    hello world


Returns a normal nodejs stream and emits the template as string data.

Δt is already packed with a simple render function to use this adapter to stream templates out through for example a http request.


Unfortunatily this disables the ability to change the template after it was rendered, but asyncronious operations like filesystem io still works pretty well.