Skip to content

Instantly share code, notes, and snippets.

@alastaircoote
Created September 10, 2020 15:51
Show Gist options
  • Save alastaircoote/100fdc34a48f96d0057679656bcee400 to your computer and use it in GitHub Desktop.
Save alastaircoote/100fdc34a48f96d0057679656bcee400 to your computer and use it in GitHub Desktop.
const stream = new ReadableStream({
start: async function(controller) {
controller.enqueue("<html>");
let content = await getSomeContent();
controller.enqueue(content);
controller.enqueue("</html>");
}
});
let r = new Response(stream,{
status: 200,
headers: {
"Content-Type": "text/html"
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment