streaming-top

0.1.2 • Public • Published

streaming-top

Wraps top in a readable stream. Parsing is done by parse-top.

const createInstance = require('streaming-top')

const top = createInstance({ samples: 10, delay: 3, args: '-n 1' })

top.on('data', data => {
  console.log(JSON.parse(data.toString()))
})

// or pipe it:
top.pipe(process.stdout)

setTimeout(() => top.kill(), 2000)
// kill the underlying top instance after 2s

default options

{
  delay: 1,
  samples: 0,
  args: ''
}

Package Sidebar

Install

npm i streaming-top

Weekly Downloads

2

Version

0.1.2

License

MIT

Last publish

Collaborators

  • rogerbf