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

280
Views
How to write to local file in fetch?

I need to write some data to local file using fetch. When i try to do my method, it is not working. Maybe fetch can not write files - i dont know. Thank you!

let recv = document.getElementById("recv").value;
  let money = document.getElementById("cost").value;
  fetch(recv+'.txt')
  .then(response => response.text())
  .then(data => {
    // Do something with your data
    let hernmon = data;
   int1 = parseInt(hernmon);
   int2 = parseInt(money);
   int3 = parseInt(moneyint)
   let outmon = int1 + int2;
    data = outmon;
  });
  fetch(name+'.txt')
  .then(response => response.text())
  .then(data => {
    // Do something with your data
    let hernmon = data;
   int1 = parseInt(hernmon);
   int2 = parseInt(money);
   int3 = parseInt(moneyint)
   let incmon = int3 - int2;
    data = incmon;
  });
  return
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

You can not directly write to a local file, since that would cause massive security problems, but you can create files in the browser using Blob and URL.createObjectURL. All recent browsers support this and provide it as a download link for the user. You can suggest a file name via the download attribute of the link, in browsers that support the download attribute. As with any other download, the user downloading the file will have the final say on the file name though...

about 4 years ago · Juan Pablo Isaza Report
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!