This works for me instead, if anybody is interested.
Appender!string mime64 = appender!string;
for (ulong i = 0; i < file.size; i += 57) {
ubyte[57] buf;
auto chunk_size = min(file.size - i, buf.length);
file.read(buf[0 .. chunk_size]);
mime64.put(Base64.encode(buf[0 .. chunk_size]));
}