Can we have a similar thing like dos2unix in javascript

395 Views Asked by At

I want to know whether we can convert from DOS(CR LF) format to UNIX(LF) format in Javascript/JQuery?

In linux/unix, we have a dos2unix command and I'm looking similar thing in javascript.

Thanks in advance, happy coding :)

1

There are 1 best solutions below

0
user2388677 On

I found answer for my question. Below is the way we can do it in javscript with the help of "string".replace.

the_string.replace(/\r\n/g, "\n")

Thanks everyone, happy coding :)