Nodejs
Get file
const fs = require('fs').promises;
const path = require('path');
const filePath = path.resolve(__dirname, '..', 'public', 'index.html');
try {
const data = await fs.readFile(filePath, 'utf-8');
console.log(data);
} catch (error) {
console.error(error);
}
Last updated
Was this helpful?