Created
June 15, 2019 17:17
-
-
Save PierBover/e8429e602d8b5a4cd113e18098165cc2 to your computer and use it in GitHub Desktop.
Node Kbps
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const https = require('https'); | |
const fs = require('fs'); | |
const writeStream = fs.createWriteStream("./log.xls"); | |
let bytes = 0; | |
https.get('https://edge.mixlr.com/channel/udesp', (resp) => { | |
resp.on('data', (buffer) => { | |
bytes += buffer.length; | |
}); | |
}); | |
setInterval(() => { | |
const kbps = bytes / 1000; | |
const time = new Date(); | |
const row = `${time.toTimeString()}\t${kbps} KBs\n`; | |
console.log(row); | |
writeStream.write(row); | |
bytes = 0; | |
}, 1000); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment