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

164
Views
Intentar usar writeFileSync junto con Node Exec para ejecutar pruebas mediante programación

Estoy tratando de crear un editor como FreecodeCamp y me encontré con un problema interesante. Tengo mi interfaz enviando una cadena que luego trato de convertir en un archivo usando el proceso de nodo writeFileSync . Luego trato de llamar a un script mediante programación usando exec desde el módulo child_processes.

 const str = req.body.code.replace(/"/g, ""); await fs.writeFileSync('./test/add.js', str) await exec('npm run test', (error, stdOut) => { console.log('error', error); console.log('stdout', stdOut) res.json({ message: stdOut }) }) })

Si me comprometo a await fs.writeFileSync('./test/add.js', str) funciona perfectamente. ¿Cómo puedo escribir un archivo y luego ejecutar mi script?

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!