SD and client.write on esp8266

I'm playing with making a esp8266 WIFI server for the arduino.

So I'm making a server and it loads an HTML page from an SD card. It works fine when I client.write(myFile.read()), one byte at a time. It's slow to load so I have it loading chunks (64 bytes) at a time which works on the Arduino but it's giving me error on the esp8266.

while(myFile.available())
            {
             
               myFile.read(tBuf,64);
               client.write(tBuf, myFile.position() - lastPosition);
               lastPosition = myFile.position();
              
              //yield for esp8266 processes
              yield();
              //multiple bytes doesn't work for esp8266
              //client.write(myFile.read());
    
             }

Here's the error. Not sure what it means. I've looked into the 'Core' and it looks like the methods are available.

In file included from /Users/minh/Library/Arduino15/packages/esp8266/hardware/esp8266/2.3.0/libraries/ESP8266WiFi/src/ESP8266WiFi.h:39:0,
from /Users/minh/Documents/Arduino_esp8266/ESP8266_WAAC_WebServer/ESP8266_WAAC_WebServer.ino:6:
/Users/minh/Library/Arduino15/packages/esp8266/hardware/esp8266/2.3.0/libraries/ESP8266WiFi/src/WiFiClient.h: In instantiation of 'size_t WiFiClient::write(T&, size_t) [with T = unsigned char [64]; size_t = unsigned int]':
/Users/minh/Documents/Arduino_esp8266/ESP8266_WAAC_WebServer/ESP8266_WAAC_WebServer.ino:202:67: required from here
/Users/minh/Library/Arduino15/packages/esp8266/hardware/esp8266/2.3.0/libraries/ESP8266WiFi/src/WiFiClient.h:123:36: error: request for member 'available' in 'source', which is of non-class type 'unsigned char [64]'
size_t left = source.available();
^
/Users/minh/Library/Arduino15/packages/esp8266/hardware/esp8266/2.3.0/libraries/ESP8266WiFi/src/WiFiClient.h:127:5: error: request for member 'read' in 'source', which is of non-class type 'unsigned char [64]'
source.read(buffer.get(), will_send);
^

The following works for files served from SPIFFS...haven't tried it with files from SD:

See July 25, 2016 posts, especially igrr's (the ESP Master...all hail the Master) posts: Found a way to upload data VERY fast by wifi · Issue #1853 · esp8266/Arduino · GitHub

With the latest git version you should get better performance...Just do client.write(webFile). This will handle buffering internally and send data as fast as it is acked, limited only be network roundtrip time and SPIFFS read time.

As noted, less than a second to serve a 307kB file.

Worth a shot.

Thanks for the link. It gave me a clue to cast the tBuf.

client.write((const uint8_t *)tBuf, myFile.position() - lastPosition);

This works. Doing it one byte at a time is fast but it could be faster.