import * as ObjectsToCsv from 'objects-to-csv';
const createCSV = async (data: any, name: string) => {
const csv = new ObjectsToCsv(data);
await csv.toDisk(path.join(__dirname, '../data/processed-csvs/' + name) );
return csv.toString();
}
// Function Call
createCSV([{
name: 'Ravi',
surname: 'Agheda'
}], 'file.csv');
Created
August 30, 2022 11:53
-
-
Save raviagheda/5fa58cd5a55cf8e6e52dc45b2b0ea253 to your computer and use it in GitHub Desktop.
Generate CSV from JSON Object
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment