bufcp

package
v0.0.0-...-04b4601 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 4, 2024 License: AGPL-3.0 Imports: 2 Imported by: 0

Documentation

Overview

Package bufcp provides functions for copying data from a reader to a writer with explicit control over buffer size and flushing of buffered data after each write. This package is particularly useful when working with the CreateWriteStream function of FastHTTP's Response, which returns a bufio.Writer. By flushing the writer after each write, data is sent to the client immediately, allowing the server to start sending large responses without having to buffer them entirely in memory first. This can help manage memory usage when working with large files or streams of data.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Copy

func Copy(dst *bufio.Writer, src io.Reader, bufSize int) (int64, error)

Copy copies from src to dst until either EOF is reached on src or an error occurs. It uses a buffer of size bufSize and flushes the buffer after each writing.

func CopyN

func CopyN(dst *bufio.Writer, src io.Reader, n int64, bufSize int) (int64, error)

CopyN copies n bytes (or until an error occurs) from src to dst. It uses a buffer of size bufSize and flushes the buffer after each writing.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL