Export a feature service to a shapefile, CSV, Excel, and other formats.
Demo by Gavin Rehkemper
Click here to see the live demo
This is like programmatically clicking the "Export" button in ArcGIS Online (or ArcGIS Enterprise). You must be logged in, and it will create a new item for the export, and then you can download it. You can do this all in one step within your JavaScript, which this sample demonstrates.
To run the demo, in a terminal run:
npx serve