2020-06-22 11:49:07 +02:00
|
|
|
const fs = require('fs');
|
|
|
|
|
const dest = fs.createWriteStream('./output');
|
|
|
|
|
const { SRTReadStream } = require('../index.js');
|
|
|
|
|
|
2020-06-22 13:03:08 +02:00
|
|
|
if (process.argv[2] === "listener") {
|
|
|
|
|
const srt = new SRTReadStream('0.0.0.0', 1234);
|
|
|
|
|
srt.listen(readStream => {
|
|
|
|
|
readStream.pipe(dest);
|
|
|
|
|
});
|
2020-06-24 12:55:23 +02:00
|
|
|
console.log("async listen");
|
2020-06-22 13:03:08 +02:00
|
|
|
} else {
|
|
|
|
|
const srt = new SRTReadStream('127.0.0.1', 1234);
|
|
|
|
|
srt.connect(readStream => {
|
|
|
|
|
readStream.pipe(dest);
|
|
|
|
|
});
|
|
|
|
|
}
|