Meu arquivo index.js está assim:
const chalk = require('chalk'); const fs = require('fs');
function pegaArquivo(caminhoDoArquivo){ const enconding = "utf-8"; fs.readfile(caminhoDoArquivo,enconding (_,texto) => { console.log(chalk.green(texto)); }); }
pegaArquivo("./arquivos/texto1.md");
Quando executo o node index.js está exibindo o seguinte erro:
C:\Users\Alessandra\Documents\Alura\NodeJS\index.js:6 fs.readfile(caminhoDoArquivo,enconding (_,texto) => { ^^^^^^^^^^^^^^^^^^
SyntaxError: Malformed arrow function parameter list ←[90m at Object.compileFunction (node:vm:352:18)←[39m ←[90m at wrapSafe (node:internal/modules/cjs/loader:1031:15)←[39m ←[90m at Module.compile (node:internal/modules/cjs/loader:1065:27)←[39m ←[90m at Object.Module.extensions..js (node:internal/modules/cjs/loader:1153:10)←[39m ←[90m at Module.load (node:internal/modules/cjs/loader:981:32)←[39m ←[90m at Function.Module.load (node:internal/modules/cjs/loader:822:12)←[39m ←[90m at Function.executeUserEntryPoint [as runMain] (node:internal/modules/runmain:81:12)←[39m ←[90m at node:internal/main/run_main_module:17:47←[39m