User Submitting Signup
This commit is contained in:
27
qrCodes/convertToJSON.js
Normal file
27
qrCodes/convertToJSON.js
Normal file
@@ -0,0 +1,27 @@
|
||||
import fs from 'fs'
|
||||
import {parse} from 'csv-parse'
|
||||
|
||||
const csvFilePath = './tokens.csv';
|
||||
const jsonFilePath = './tokens.json';
|
||||
|
||||
fs.readFile(csvFilePath, 'utf8', (err, data) => {
|
||||
if (err) {
|
||||
console.error('Error reading file:', err);
|
||||
return;
|
||||
}
|
||||
|
||||
parse(data, { columns: true, skip_empty_lines: true }, (err, output) => {
|
||||
if (err) {
|
||||
console.error('Error parsing CSV:', err);
|
||||
return;
|
||||
}
|
||||
|
||||
fs.writeFile(jsonFilePath, JSON.stringify(output, null, 2), (err) => {
|
||||
if (err) {
|
||||
console.error('Error writing JSON file:', err);
|
||||
} else {
|
||||
console.log(`JSON successfully written to ${jsonFilePath}`);
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -1,6 +1,7 @@
|
||||
{
|
||||
"type": "module",
|
||||
"dependencies": {
|
||||
"csv-parse": "^6.1.0",
|
||||
"csv-writer": "^1.6.0",
|
||||
"qrcode": "^1.5.4",
|
||||
"uuid": "^13.0.0"
|
||||
|
||||
Reference in New Issue
Block a user