ESPAsyncWebServer icon indicating copy to clipboard operation
ESPAsyncWebServer copied to clipboard

AsyncWebServer download SPIFFS file truncated

Open mugginsjm opened this issue 3 years ago • 5 comments

Hi can someone please help. I have been using SPIFFS to log activity on my app and have a file of approx 200 lines. On my web page when I call: request->send(SPIFFS, "/fridge.txt", "text/plain"); I get a truncated file (approx 50 lines) and then this at bottom.

HTTP/1.1 302 Found Content-Length: 0 Connection: close Location: / Accept-Ranges: none

Similarly if I attempt a download using request->send(SPIFFS, "/fridge.txt", String(), true); the process freezes. I'm sure this is something obvious but with numerous hours of searching I cannot resolve. thanks John

mugginsjm avatar Oct 19 '22 11:10 mugginsjm

Looks like I need to use "chunking" but the examples I have found are very complex (to me) and don't seem to lend themselves to simple Spiffs text files. Is there a simpler method?

mugginsjm avatar Oct 19 '22 21:10 mugginsjm

You didn't give any MCVE to reproduce so it's hard to guess (and waste of time). Basically said serving of SPIFFS (is obsolete, use LittleFS instead) file is working. I'm transferring >100kB this way. File response already use chunked encoding internally. You can also try to let the server serve file internally using serveStatic.

Pablo2048 avatar Oct 20 '22 11:10 Pablo2048

Hi Thanks for response. I had originally been using LITTLEFS for ESP32 and just tried SPIFFS as a last resort. I will put together an abridged version to demonstrate the problem. thanks 2 hours later Reverted to LITTLEFS and in the process of simplifying my code it now works!! Don't know why. I have looked at maybe a hundred references to asyncwebserver and spiffs/littlefs with reference to large files. All refer to chunking. ?? thanks again

mugginsjm avatar Oct 20 '22 12:10 mugginsjm

Hi I'm back again. I thought I had a reliable download from LittleFS but now find with larger log files of 600 lines plus, approx 120k, that download stalls and I get "download-network issue" Any advice anyone... thanks John

mugginsjm avatar Nov 04 '22 18:11 mugginsjm

[STALE_SET] This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs. Thank you for your contributions.

stale[bot] avatar May 22 '23 01:05 stale[bot]