node-netstat
node-netstat copied to clipboard
Add promise support
Thanks for the suggestion! I will be including promises with the next major revision
Workaround
const netstatP = opts =>
new Promise((resolve, reject) => {
const res = []
netstat(
{
...opts,
done: err => {
if (err) return reject(err)
return resolve(res)
},
},
data => res.push(data),
)
return res
})
EDIT: Couldn't get it to work.
For what it's worth, @vjpr snippet worked for me when running:
netstatP({ filter: { protocol: 'tcp' } }).then((data) => {
console.log('data', data)
})