diff --git a/src/bin/hgjson.ts b/src/bin/hgjson.ts index 705fed4..1bbb70f 100755 --- a/src/bin/hgjson.ts +++ b/src/bin/hgjson.ts @@ -55,7 +55,7 @@ const client = new HargassnerTelnet(argv.ip, argv.port, { }) client.on('data', (data) => { - console.log(argv.formatted ? data : JSON.stringify(data)) + console.log(argv.formatted || argv.raw ? data : JSON.stringify(data)) // Handle --once if (argv.once) process.exit(0) }) diff --git a/src/hargassnerTelnet.ts b/src/hargassnerTelnet.ts index 033e5e9..a42bff5 100644 --- a/src/hargassnerTelnet.ts +++ b/src/hargassnerTelnet.ts @@ -66,7 +66,7 @@ export class HargassnerTelnet { data = this.parse(dataSplit) } else { // Raw set just return the string - data = buffer.toString() + data = buffer.toString().replace(/(.*) \r\n/g, '$1') } this.callbacks.data?.forEach((callback) => callback(data))