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

138
Views
Generating files in nodejs escape character issue

I have a NestJs project where I am trying to generate js files into the CDN blob storage. For eg I have this object:

{
 "prop1":"${resolvedprop1}",
 "prop2":"John's pet"
}

content of the generated js file should look like:

var metadata=()=>JSON.parse('{ "prop1":"${resolvedprop1}", "prop2":"John's pet" }')

Code for generation of the file:

function writeToCDN(metadata){
    const content = `var metadata = ()=>JSON.parse('${JSON.stringify(metadata)}')`;
    //write content string to a file in CDN BLOB.
}

When I load this file into the browser and execute metadata() I get an error when parsing because the single quote is not escaped.

Important note: I can not use backtick instead of single quote inside JSON.parse since I am expecting ${} in the prop1 value.

Thank you for your help in advance!

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!