Skip to content

Instantly share code, notes, and snippets.

@bennidi
Created September 13, 2018 17:14
Show Gist options
  • Save bennidi/bf69ddf1a23eb0c9dd1c26e304bf6b5e to your computer and use it in GitHub Desktop.
Save bennidi/bf69ddf1a23eb0c9dd1c26e304bf6b5e to your computer and use it in GitHub Desktop.
Node.js: Composing multiple streams into one
import string_stream from 'string-to-stream'
import multi_stream from 'multistream'
ctx.status = 200
ctx.body = multi_stream
([
string_stream(before_content),
typeof content === 'string' ? string_stream(content) : content,
string_stream(after_content)
])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment