1.0.1 • Published 6 years ago

streamcatcher v1.0.1

Weekly downloads
3
License
MIT
Repository
github
Last release
6 years ago

streamcatcher

Capture a http stream for a duration of time

usage

Create a StreamCatcher object with the following parameters:

url {string} the url of the http stream to capture

duration {string} how long to capture (Moment duration string: see https://momentjs.com/docs/#/durations/creating/)

basename {string} the file name without path and without extension

dirTmp {string} where to save the stream to until capture is complete

dirToSaveTo {string} where to save the file finally when capture is complete

logger {logger} the logger object

const url = 'http://pri.gocaster.net/td4';
const streamCatcher = new StreamCatcher(url, "PT3S", 'testdownload', 'test/tmp/down', 'test/tmp/final', console);
streamCatcher.execute()
  .then((filename) => fs.stat(filename))
  .then((stats) => console.log(filename.size + " bytes captured!"))