Function sendFile [src]

Unlike writeSplat and writeVec, this function will call into VTable even if there is enough buffer capacity for the file contents. The caller is responsible for flushing. Although the buffer may be bypassed as an optimization, this is not a guarantee. Although it would be possible to eliminate error.Unimplemented from the error set by reading directly into the buffer in such case, this is not done because it is more efficient to do it higher up the call stack so that the error does not occur with each write. See sendFileReading for an alternative that does not have error.Unimplemented in the error set.

Prototype

pub fn sendFile(w: *Writer, file_reader: *File.Reader, limit: Limit) FileError!usize

Parameters

w: *Writerfile_reader: *File.Readerlimit: Limit

Possible Errors

EndOfStream

Reached the end of the file being read.

ReadFailed

Detailed diagnostics are found on the File.Reader struct.

Unimplemented

Indicates the caller should do its own file reading; the callee cannot offer a more efficient implementation.

WriteFailed

See the Writer implementation for detailed diagnostics.

Source

pub fn sendFile(w: *Writer, file_reader: *File.Reader, limit: Limit) FileError!usize { return w.vtable.sendFile(w, file_reader, limit); }