Handles file list requests to the server.
Handles file list requests to the server.Manages the file list process, including:
- Checking for valid request arguments (dir) and returning an error response if missing
- Opening the directory using LittleFS.openDir() and iterating through entries
- Constructing a JSON response with file information (type and name)
- Returning a 200 response with the JSON file list
- Supports CORS requests and sends the necessary headers to allow cross-origin requests
- Example JSON response: [{"type":"dir","name":"directory"},{"type":"file","name":"file.txt"}]
- Note
- This function is called by the server to handle file list requests. () handles a file list request