Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

133
Views
Node.js/JS converting standard windows paths to useable file path for CLI application

I am very new to node and JavaScript, but I have a simple Node.js CLI application working that extracts images from Photoshop .PAT files and saves them to a specified directory.

I've noticed that in order for the paths that I pass in as arguments (input_pat for the input .pat file, and output_dir for the destination directory) they must either use forward slashes, or double backslashes or Node freaks out.

What I want to be able to do is this:

node save.js "C:\patterns\library.pat" "C:\Users\user\Desktop\pat-parser-master\src\save\"

Is there a way to convert standard windows path notation into a format that javascript will accept? I.E. replacing all backslashes with forward slashes, or doubling up the backslashes?

Must I always use double backslashes or forward slashes when passing in paths?

Any help or guidance would be greatly appreciated!

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!