Reputation: 15702
How to log this stream of data without a newline each time?
websocket.on('message', (msg) => {
console.log(msg.content);
}
});
Above would result in:
> streamedContent-1
> streamedContent-2
> streamedContent-3..
What I want to achieve is:
> streamedContent-n // this line getting updated on each refresh, no new line
Upvotes: 0
Views: 398
Reputation: 5249
You can use c++ stdout
methods inside a Node app to "edit" a line in runtime.
process.stdout.clearLine()
process.stdout.write(`\r${msg.content}`);
Upvotes: 1