Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

233
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!