Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrapper to fs::FS to use SDfat in ESPAsyncWebserver #471

Open
JoergTiedemann opened this issue Feb 19, 2024 · 6 comments
Open

Wrapper to fs::FS to use SDfat in ESPAsyncWebserver #471

JoergTiedemann opened this issue Feb 19, 2024 · 6 comments

Comments

@JoergTiedemann
Copy link

Is there any wrapper to use Sdfat with a ESPAsyncWebserver to convert sdfat to to fs::FS because of ESPAsyncWebserver needs in AsyncWebServerRequest::send a FS object
or how can I do that ?

@greiman
Copy link
Owner

greiman commented Feb 19, 2024

I don' know of any use of SdFat with ESPAsyncWebserver.

I avoid using ESP32/ESP8266 because SdFat often conflicts with the ESP file system.

@JoergTiedemann
Copy link
Author

I found a wrapper, will post it next weekend
Investors to use the lib on Esp32 because of firebase library by @mobizt requires it because of your library has adjustable speed for spi interface

@VeloSteve
Copy link

Any chance you can post that wrapper? SD.h is unreliable for me (on Arduino Nano ESP32), but SdFat is stable, so I need to use SdFat.

@JoergTiedemann
Copy link
Author

Hi gimme a chance this weekend
I will try to search the wrapper and post it, if you didn't got any post from me remember me latest this Sunday

@JoergTiedemann
Copy link
Author

JoergTiedemann commented Mar 16, 2024

sd_fat32_fs_wrapper.zip
In the attachment you will find the wrapper
just include the file

I use it als following

SdFat sd_fat_fs;
fs::FS sdfilesys = fs::FS(fs::FSImplPtr(new SdFat32FSImpl(sd_fat_fs)));

If you want to use it with ESP Async Webserver in a response at server.on...
i.g. to respond a picture from an sd card
String picturefilene ="picture.jpg";
request->send(sdfilesys,picturefilename, "image/jpg", false);
hope this helps

@VeloSteve
Copy link

Thank you! I missed your post for a few days and came up with the workaround of replacing send(SD, filename . . . ) calls with sendChunked and my own simple function which gets data from the file using SdFat. Your wrapper is probably nicer, so I'll try it out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants