Node.js: printing to console without a trailing newline?
You can use process.stdout.write()
:
process.stdout.write("hello: ");
See the docs for details.
Also, if you want to overwrite messages in the same line, for instance in a countdown, you could add \r
at the end of the string.
process.stdout.write("Downloading " + data.length + " bytes\r");