dmikester1 – 03-42 May 1

I have some code that I think I need to promisify.
await compressFolder(PNGFolder, PNGFolder + '/');
    while (!fs.existsSync(PNGFolder + '/')) {
      console.log('Zip file does not exist');

The compressFolder function is supposed to create that zip file. But when I run my code, it just sits and continuously outputs 'Zip file does not exist' in what looks like a forever loop.
I think the issue is that I need to promisify the compressFolder function.
compressFolder looks like this:
export const compressFolder = async (srcDir, destFile) => {
  const start =;
  try {
    fs.readdir(srcDir, async function (error, files) {
      var totalFiles = files.length; // return the number of files
      const zip = await createZipFromFolder(srcDir);
      return zip
        .generateNodeStream({ streamFiles: true, compression: 'DEFLATE' })
        .on('error', (err) => console.error('Error writing file', err.stack))
        .on('finish', () => {
          console.log('Zip written successfully:', - start, 'ms');
          return { message: `Zip written successfully: ${ - start} ms`};
  } catch (ex) {
    console.error('Error creating zip', ex);