I have a text file that is simply just:
a
b
c
1
2
3
I'm using fs from Node and I've read data using it before fine as long as it only reads data and separates it by a newline character.
I have:
var fs = require('fs')
var input = fs.readFileSync("./test.txt").toString().split("\n\n")
console.log(input)
This returns
[ 'a\r\nb\r\nc\r\n\r\n1\r\n2\r\n3' ] // [ 'abc 123']
and not what I'd like, which is
[ 'a\r\nb\r\nc', '1\r\n2\r\n3' ] // [ 'abc', '123' ]
Could someone explain to me the problem here? Also if you wouldn't mind explaining what the \r means that would be amazing! Thank you so much!