@neiderruiz/translate-files
Version:
Internationalize and manage your website easily with (CSV or JSON to i18n)
12 lines (11 loc) • 371 B
text/typescript
import fs from 'fs';
export const readJsonFile = (filePath: string) => {
try {
const data = fs.readFileSync(filePath, 'utf8'); // Lee el archivo JSON
const jsonContent = JSON.parse(data); // Parse JSON content
return jsonContent;
} catch (error) {
console.error(`Error reading JSON file: ${error}`);
return null;
}
}