0

I'm setting up a new server, and want to save arbitrary file in my project directory. So I use Node.js path, __dirname.

I want to convert __dirname, now my __dirname is d:\algorithm-visualizer\ but I want to __dirname is d:\\\algorithm-visualizer\\\ form (have two double-escaping the backslashes). How can I convert this form?

1565986223
  • 6,420
  • 2
  • 20
  • 33
  • Why don't you just search for the `\ ` characters and replace them by `\\\\`? – Rodrigo Rodrigues May 20 '19 at 15:51
  • Possible duplicate of [Fastest method to replace all instances of a character in a string](https://stackoverflow.com/questions/2116558/fastest-method-to-replace-all-instances-of-a-character-in-a-string) – Rodrigo Rodrigues May 20 '19 at 15:53

0 Answers0