| 134 | } |
| 135 | |
| 136 | Bytes getFile(const Path& path) override |
| 137 | { |
| 138 | mount(); |
| 139 | auto pathstr = toUpper(path.to_str()); |
| 140 | FIL fil; |
| 141 | FRESULT res = f_open(&fil, pathstr.c_str(), FA_READ); |
| 142 | throwError(res); |
| 143 | |
| 144 | Bytes bytes; |
| 145 | ByteWriter bw(bytes); |
| 146 | |
| 147 | while (!f_eof(&fil)) |
| 148 | { |
| 149 | uint8_t buffer[4096]; |
| 150 | UINT done; |
| 151 | res = f_read(&fil, buffer, sizeof(buffer), &done); |
| 152 | throwError(res); |
| 153 | |
| 154 | bw += Bytes(buffer, done); |
| 155 | } |
| 156 | |
| 157 | f_close(&fil); |
| 158 | |
| 159 | return bytes; |
| 160 | } |
| 161 | |
| 162 | void putFile(const Path& path, const Bytes& bytes) override |
| 163 | { |