Writing image data to filesystem FS Electron Node.js

So I am trying to download an image. But everything I try it keeps giving me the same kind of error. Anyone got the same problem or solution why fs won’t work in fs.

Versions:
Node: 16.14.0
npm: 8.2.0
Electron: ^16.0.7

Current error:d.writeFile is not a function

My code:

// dependecies:
const axios = require('axios');
const fs = require('fs');


        image.promise = new Promise((resolve, reject) => {
          const formData = new FormData();
          formData.append('files', file);
          axios
            .post('http://api.resmush.it/', formData, { headers: { 'Content-Type': 'multipart/form-data' } })
            .then(response => {
              const url = response.data.dest;
              function downloadFile() {
                axios
                  .get(url)
                  .then(response => {
                    console.log(response)
                    console.log(response.data)
                    fs.writeFile("/tmp/test", "Hey there!", function(err) {
                          if(err) {
                              return console.log(err);
                          }
                          console.log("The file was saved!");
                      });
                      fs.writeFileSync('/tmp/test-sync', 'Hey there!');

                    })
                  // .then(response => resolve(response))
                  // .catch(() => reject());
                  .catch(reject => {console.log(reject)})
              }
              downloadFile();
            })
            .catch(() => reject());
        })