rogerbf / lumberman

filter stream data into separate events

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

lumberman

Filter stream data into separate events.

usage

import lumberman from 'lumberman'
import split from 'buffer-split-transform'

const log = lumberman({
  source: child.stdout,
  transform: [ split() ],
  emit: [
    { eventName: `complete`, filter: /\[complete]/g },
    { eventName: `warning`, filter: /\[warning]/g }
  ]
})

log.on(`complete`, console.log)
log.on(`warning`, console.error)

log.pipe(fs.createReadStream(`raw_log`))

About

filter stream data into separate events


Languages

Language:JavaScript 100.0%