I am using nodejs in my application and need to deal with ANSI character. I am looking for a way to translate a ANSI to a normal string. For example, I get this ANSI characters:
db[3G[Jdb[5G
then translate should be:
`[3G` -> go to the 3rd column which is d
`[j]` -> earse below
`[5G` -> move cursor to 5th column
after that the string character should be db
.
But if I use strip-ansi
library, it will give a string dbdb
which includes db
twice. Is there a way for me to deal with the ANSI character gracefully?
I have tried utf8
module but the encode
and decode
methods don't help.