This code snippet works to have some string data saved to file using your browser:
String reply = "this is a demo string";
WebServer.sendHeader("Content-Disposition", "attachment; filename=settings.txt");
WebServer.send(200, "application/octet-stream", reply);
and this snippet works for sending a file on SPIFFS:
dataType = F("application/octet-stream");
File dataFile = SPIFFS.open(path.c_str(), "r");
WebServer.sendHeader("Content-Disposition", "attachment;");
WebServer.streamFile(dataFile, dataType);
But I would like to send a byte array from memory to the webbrowser, so I guess that I would need something like:
WebServer.StreamData(byte* data, int datasize)
Is there a method of sending binary data without using StreamFile ?
I can convert the binary data to hex string beforehand, but this is not what I want because it doubles the filesize.
Does anyone have a sample code on how to achieve this?