MCPcopy Create free account
hub / github.com/Barracuda09/SATPI / readFile

Method readFile

src/HttpServer.cpp:66–76  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

64}
65
66std::size_t HttpServer::readFile(const char *filePath, std::string &data) const {
67 std::ifstream file;
68 file.open(filePath);
69 if (file.is_open()) {
70 data = std::string((std::istreambuf_iterator<char>(file)), std::istreambuf_iterator<char>());
71 file.close();
72 return data.size();
73 }
74 SI_LOG_ERROR("Unable to read from File: %s", filePath);
75 return 0;
76}
77
78bool HttpServer::methodPost(SocketClient &client) {
79 const std::string content = StringConverter::getContentFrom(client.getMessage());

Callers

nothing calls this directly

Calls 2

openMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected