unify copyFile and downloadFile functions into fetchFile, which will determine which one to call