Standard library / mime/quotedprintable

quotedprintable.Writer.Write()

Encode input bytes with a 76-character encoded-line limit. The returned count refers to original input bytes. Expected stdout: '3\na=3Db\n'.

Formal Syntax & Structure

go syntaxgo
func (w *Writer) Write(p []byte) (n int, err error)

Parameters & Attributes

NameTypeDescription
p[]byteByte buffer for reading or source bytes for writing, according to the operation.

Return Value

(n int, err error)

Number of source bytes consumed and error.

Working Example

Example Snippetgo
package main
import (  "bytes"  "fmt"  "mime/quotedprintable")
func main() {  var b bytes.Buffer  w := quotedprintable.NewWriter(&b)  fmt.Println(must(w.Write([]byte("a=b"))))  check(w.Close())  fmt.Println(b.String())}
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