I can't find any reference to using CS on my Node MCU. This guy, SD card Webserver using Esp8266 Nodemcu - YouTube, clearly has it working, CS is on D8, and he shows the code, but I cannot see any reference to the CS that I can understand. The SDWebserver example for ESP8266 in the IDE is equally uninformative, as is everything else I have found.
I assume the library quoted is the standard Arduino library, and therefore the CS commands aren't hidden away in there.
The ESP8266 core for Arduino has its own SD library. Generally the ESP8266 people try to weasel out of writing documentation by passing people off on the Arduino reference pages and in this case there is no documentation provided by ESP8266 so you have to either hope the Arduino reference is correct or read the source code:
in fact the Arduino SD library reference does not completely document the functions of the library but it is correct in saying that you can set the CS pin via begin().
The ESP8266 sets a default value for cs that is used if you don't provide that argument to begin. With a bit of surfing through the source code we find that the default is set to SD_CHIP_SELECT_PIN, which is set to SS_PIN on the ESP8266, which is set to SS, which is defined as 15, whew! But this pin 15 is different from the Dn pin numbers you may be used to using on your NodeMCU board so we must dip into the source once more to find that indeed pin 15 is otherwise known as D8! But for anyone else reading this, remember that is only the pin mapping for the nodemcu variant. Other ESP8266 boards (such as the WeMos D1 non-mini) may have different Dn mappings.
So you can use D8 or you can set the CS pin to whatever you like via begin()
pert:
Generally the ESP8266 people try to weasel out of writing documentation by passing people off on the Arduino reference pages ..........The ESP8266 sets a default value for cs that is used if you don't provide that argument to begin. ..........ndeed pin 15 is otherwise known as D8!
So you can use D8 or you can set the CS pin to whatever you like via begin()
So THAT'S the secret kept close to the chest by the In Crowd! I have found that I'm not alone in asking about this, and the answer some other guy's got was utterly unhelpful.