Standard library / net/textproto

textproto.Reader.ReadDotBytes()

Read the entire dot-framed block as decoded bytes; use a bounded streaming reader for large inputs. Expected stdout: '".hello\\nworld\\n"\n'.

Formal Syntax & Structure

go syntaxgo
func (r *Reader) ReadDotBytes() ([]byte, error)

Return Value

([]byte, error)

Decoded block bytes and error.

Working Example

Example Snippetgo
package main
import (  "bufio"  "fmt"  "net/textproto"  "strings")
func main() {  r := textproto.NewReader(bufio.NewReader(strings.NewReader("..hello\r\nworld\r\n.\r\n")))  fmt.Printf("%q\n", string(must(r.ReadDotBytes())))}
func must[T any](v T, e error) T {  if e != nil {    panic(e)  }  return v}func check(e error) {  if e != nil {    panic(e)  }}
Go Reference