import { saveAs } from 'file-saver'
export function downloadFile(resource: string | Blob | File, fileName?: string) {
  return new Promise((resolve) => {
    if (fileName) {
      saveAs(resource, fileName)
      return
    }

    saveAs(resource)

    resolve(null)
  })
}
