The Fermi Large Area Telescope as a cosmic-ray detector