1.1.1 • Published 5 years ago
streaming-dot v1.1.1
Streaming doT
Streaming doT is tagged template literal for creating streamed responses.
Quick facts:
- Tagged template literal
dot\...``. - Creates a WHATWG
ReadableStreamofArrayBufferfor direct compatibility withResponse. - Input can be strings, arrays,
ArrayBuffers,ReadableStreams andPromises. - Strings will automatically be encoded using UTF-8.
- 430B Brotli’d.
- Works in Firefox, Safari, Edge and Chrome.
- Written in TypeScript.
Quickstart
import {dot} from "streaming-dot";
new Response(dot`
<!doctype html>
${caches.match("/header.html")}
${fetch("/article.html?body-only=true")}
<h1>Other articles</h1>
<ul>
${
(await idb.get("cached-articles))
.map(article => dot`
<li><a href="${article.link}">${article.title}</a></li>
`)
}
</ul>
${caches.match("/footer.html")}
`);API
dot
Tagged template literal. See example above.
Compatibility
Streaming doT does not use TransformStream, or WritableStream and therefore works in all major browers.
Node
Planned, but not done yet.
Apache 2.0
2.0.0-alpha.0
5 years ago
2.0.0-alpha.1
5 years ago
1.1.1
9 years ago
1.1.0
9 years ago
1.0.3
9 years ago
1.0.2
9 years ago
1.0.1
9 years ago
1.0.0
9 years ago