DoxigAlpha

writeFile

Function parameters

Parameters

#
file:std.fs.File

Type definitions in this namespace

Types

#

Functions in this namespace

Functions

#
adaptToNewApi
Helper for bridging to the new `Writer` API while upgrading.

Source

Implementation

#
pub fn writeFile(self: Self, file: std.fs.File) anyerror!void {
    // TODO: figure out how to adjust std lib abstractions so that this ends up
    // doing sendfile or maybe even copy_file_range under the right conditions.
    var buf: [4000]u8 = undefined;
    while (true) {
        const n = try file.readAll(&buf);
        try self.writeAll(buf[0..n]);
        if (n < buf.len) return;
    }
}