Use a more generic version of downloadToFile