Files
CDN-APP-INSIDER/models/fileCreated.js
Dinawo 8f3e604774
All checks were successful
continuous-integration/drone/push Build is passing
Update .gitignore and add new dependencies and routes
2024-04-02 20:59:13 +02:00

16 lines
564 B
JavaScript

const fs = require('fs');
const path = require('path');
const { logger, ErrorLogger, logRequestInfo } = require('../config/logs');
const dataFolderPath = path.join(__dirname, '../data');
const filesToCreate = ['setup.json', 'user.json', 'file_info.json'];
filesToCreate.forEach((fileName) => {
const filePath = path.join(dataFolderPath, fileName);
if (!fs.existsSync(filePath)) {
fs.writeFileSync(filePath, '[]');
logger.info(`${fileName} created successfully.`);
} else {
logger.info(`${fileName} already exists.`);
}
});