Standard library / bufio

bufio.NewWriterSize()

Creates a writer with at least the requested capacity; may reuse a sufficiently large buffered Writer. Expected stdout: 'true\n'.

Formal Syntax & Structure

go syntaxgo
func NewWriterSize(w io.Writer, size int) *Writer

Parameters & Attributes

NameTypeDescription
wio.WriterDestination writer.
sizeintRequested buffer capacity.

Return Value

*Writer

Creates a writer with at least the requested capacity; may reuse a sufficiently large buffered Writer.

Working Example

Example Snippetgo
package main
import (  "bufio"  "fmt"  "io")
func main() { w := bufio.NewWriterSize(io.Discard, 32); fmt.Println(w.Size() >= 32) }
Go Reference