Standard library / bufio

bufio.Writer.Buffered()

Returns the number of bytes waiting in the buffer; does not mean they have reached the destination. Expected stdout: '3\n'.

Formal Syntax & Structure

go syntaxgo
func (b *Writer) Buffered() int

Return Value

int

Returns the number of bytes waiting in the buffer; does not mean they have reached the destination.

Working Example

Example Snippetgo
package main
import (  "bufio"  "fmt"  "io")
func main() { w := bufio.NewWriter(io.Discard); w.WriteString("abc"); fmt.Println(w.Buffered()) }
Go Reference