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

213
Visualizações
Print file on client side

I am using FileSaver.js to print an object array on the client side (HTML/Typescript).

var blob = new Blob([JSON.stringify( marray)], {type: "text/plain;charset=utf-8"});
 saveAs(blob, "Data.txt");

It works fine. The problem is it downloads in the download folder (by default). I want to add a file path along with its name. Any idea? Or another way to do this job. fs is not working in this case. it is not recognizing fs and gives the error fs.writefilesync is not a function

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

  1. How do you know what path the user has?

  2. It is not safe. There is no way to "climb" the user's file system

  3. If you open the source code, you will see the simplest implementation scheme there. It's just a click on a link download

    var a = document.createElement('a')
    // ...
    a.href = blob
    // ...
    a.dispatchEvent(new MouseEvent('click'))
    
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