1.0.0 • Published 10 years ago

ejs-stream v1.0.0

Weekly downloads
1
License
MIT
Repository
github
Last release
10 years ago

ejs-stream

A through stream for rendering objects with ejs templates

npm install ejs-stream

Usage

Pass a template as first argument to the constructor. The second options map is passed to the ejs compile function.

var ejs = require('ejs-stream');

var stream = ejs('Hello <%- name %>');

stream.write({ name: 'you' });
stream.end();

Or piping from a readable stream.

var ejs = require('ejs-stream');
var mongojs = require('mongojs');

var db = mongojs('...', ['customers']);

db.customers.find()
	.pipe(ejs('<%- address %> <%- name %>'))
	.pipe(process.stdout);