Standard library / encoding/ascii85

encoding/ascii85.Decode()

Decode ASCII85 into a caller-owned buffer. Returns output bytes and input bytes consumed; flush true handles a final partial group. Strip external delimiters before decoding. Expected stdout: 'Go 3\n'.

Formal Syntax & Structure

go syntaxgo
func Decode(dst, src []byte, flush bool) (ndst, nsrc int, err error)

Parameters & Attributes

NameTypeDescription
dst[]byteDestination byte slice; provide enough capacity for the operation or use an append API.
src[]byteInput bytes in the format expected by the operation.
flushboolTrue if this is the final input fragment; false if more bytes may follow.

Return Value

(ndst, nsrc int, err error)

Bytes written, bytes consumed, and decoding error.

Working Example

Example Snippetgo
package main
import (  "encoding/ascii85"  "fmt")
func must(e error) {  if e != nil {    panic(e)  }}
func main() {  dst := make([]byte, 4)  n, c, err := ascii85.Decode(dst, []byte("7rJ"), true)  must(err)  fmt.Println(string(dst[:n]), c)}
Go Reference