Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

237
Visualizações
having trouble with the README Generator but for some reason fs.writeToFile is not a function

This is the code that is causing the error:

const writeToFile = data  => {
    return new Promise((resolve, reject) => {
        fs.writeFile('./dist/generated-README.md', data, err => {
            if (err) {
                reject(err);
                return;
            }

            resolve({
                ok: true,
                message: console.log('File created!')
            });
        })
    })
}

I'm getting an error that says that fs.writeToFile is not a function. Why is that and how do I fix it?

about 4 years ago · Santiago Gelvez
1 Respostas
Responde à pergunta

0

fs.writeToFile is not a function because it's called fs.writeFile. You would need to simply change the name. Also, I'm not sure about that console.Console.log function, It's just console.log.

const writeToFile = data  => {
    return new Promise((resolve, reject) => {
        fs.writeFile('./dist/generated-README.md', data, err => {
            if (err) {
                reject(err);
                return;
            }

            resolve({
                ok: true,
                message: console.log('File created!')
            });
        })
    })
}
about 4 years ago · Santiago Gelvez Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda