Skip to content

Instantly share code, notes, and snippets.

@timwis
Created August 13, 2016 21:01
Show Gist options
  • Save timwis/b317754958319ddf72f99fbddcf164e1 to your computer and use it in GitHub Desktop.
Save timwis/b317754958319ddf72f99fbddcf164e1 to your computer and use it in GitHub Desktop.
const htmlIndex = require('simple-html-index')
const BufferList = require('bl')
function createPage (title) {
const html = htmlIndex({ title })
const htmlBuffer = html.pipe(BufferList())
return function flush () {
// return htmlBuffer // works
return htmlBuffer.duplicate() // doesn't work (empty)
}
}
const page = createPage('Hello')
page().pipe(process.stdout)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment