I've got the following async code.
const dlcOrNot = async (file) => {
  console.log('Unpacking dlc file...')
  if (file.indexOf('.dlc') > -1) {
    await decrypt.upload(file, (err, response) => {
      const links = response.success.links;
      writeFile('urls.txt', String(links).replace(/,/g, '\n'), 'utf-8', () => {
        return 'urls.txt';
      });
    });
  } else {
    return file;
  };
};
My problem is the if statement returns undefined instantly before decrypt.upload() ran, how can I make it wait for the function inside to return its value?
 
    