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

149
Views
Ejecutar terminal(?) en el navegador

Básicamente, lo que quiero hacer es:

Tengo estos datos que obtengo usando XHR y los muestro en el navegador.

 [ { "name": "task1", "todo": "Complete online Javascript course" }, { "name": "task2", "todo": "Jog around the park 3x" }, { "name": "task3", "todo": "10 minutes meditation" } ]
 let dataUse = [] getData = () => { const xhttp = new XMLHttpRequest(); xhttp.onreadystatechange = function() { if (this.readyState == 4 && this.status ==200) { const myData = JSON.parse(this.responseText) dataUse.push.apply(dataUse, myData) } } xhttp.open("GET", "data.json", true); xhttp.send(); } getData()

Y lo que quiero hacer es tener un cuadro donde pueda agregar nuevos datos al archivo JSON.

 saveData = () =>{ myData.push(newData) const fs = require('fs') const finished = (error) =>{ if(error){ console.error(error) return } } const jsonData = JSON.stringify(myData, null, 2) fs.writeFile('data.json', jsonData, finished) }

El problema es que esta línea de código debe ejecutarse a través de la terminal para que escriba los nuevos datos en el archivo, por lo que quiero saber si hay una forma de ejecutar la terminal en el navegador a través de algún tipo de función o algo así. .

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!