"TypeError: fs.existsSync is not a function"
I get this error when i want to generate a csv file and put some data in it.
const objectstocsv = require('objects-to-csv');
export default {
data () {
return {
data : [
{code: 'CA', name: 'California'},
{code: 'TX', name: 'Texas'},
{code: 'NY', name: 'New York'},
],
}
},
methods: {
async exportData(){
const csv = new objectstocsv(this.data);
await csv.toDisk('./file.csv');
console.log('ok')
},
}
}
Function is called when I click on a button. I don't get it