Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

276
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda