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

217
Views
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 answers
Answer question

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 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!