0

I create csv file download using CSVLink but not save to specific directory. Someone can help me how to give directory path ? (eg → C:\Users\project\csv)

import {CSVLink, CSVDownload} from 'react-csv';

const csvData =[
  ['firstname', 'lastname', 'email'] ,
  ['Ahmed', 'Tomi' , 'ah@smthing.co.com'] ,
  ['Raed', 'Labes' , 'rl@smthing.co.com'] ,
  ['Yezzi','Min l3b', 'ymin@cocococo.com']
];
<CSVLink data={csvData} filename={"test.csv"}>Download me</CSVLink>
'''
Momo
  • 81
  • 10

1 Answers1

0

Any write on local is not allowed in Web. As it will cause huge security risks.

I suggest prompting user for file location.

AreUMinee
  • 81
  • 7
  • Thank you for answer. Please can u show alittle example or reference link? – Momo Apr 20 '21 at 11:52
  • Documentation: https://wicg.github.io/file-system-access/ Demo: https://googlechromelabs.github.io/text-editor/ Source stackoverflow answer: https://stackoverflow.com/a/61543043/7884383 – AreUMinee Apr 20 '21 at 12:59