streaming html templates
like hyperstream, but faster. it does not support all hyperstream features.
npm install hstream
var hyperstream =
Create a through stream that applies
updates is an object with CSS
selectors for keys. Values can be different types depending on what sort of
update you want to do.
Selectors support the most common CSS features, like matching tag names, classes, IDs, attributes. Pseudo selectors are not supported, but PRs are welcome.
Pass a stream or string to replace the matching element's contents with some
HTML. Pass an object to set attributes on the matching element or do some
special operations. When passing an object, you can use keys prefixed with
for the following special operations:
_html- Replace the matching element's contents with some HTML
_prependHtml- Prepend some HTML to the matching element
_appendHtml- Append some HTML to the matching element
_replaceHtml- Replace the entire element with some HTML
All properties accept streams and strings.
npm run bench.
NANOBENCH version 2 > node bench/hyperstream.js # hyperstream single ok ~5.38 s (5 s + 381237046 ns) # hyperstream many ok ~5.67 s (5 s + 673399368 ns) # hyperstream small file ok ~946 ms (0 s + 946487806 ns) # hstream single ok ~1.16 s (1 s + 159528184 ns) # hstream many ok ~951 ms (0 s + 951094352 ns) # hstream small file ok ~70 ms (0 s + 70058016 ns) all benchmarks completed ok ~14 s (14 s + 181804772 ns)