Standard library / mime/multipart

multipart.Writer.Boundary()

Return the current multipart delimiter, without its wire-format hyphens. Expected stdout: 'demo\n'.

Formal Syntax & Structure

go syntaxgo
func (w *Writer) Boundary() string

Return Value

string

Current multipart boundary.

Working Example

Example Snippetgo
package main
import (  "bytes"  "fmt"  "mime/multipart")
func main() {  var b bytes.Buffer  w := multipart.NewWriter(&b)  check(w.SetBoundary("demo"))  fmt.Println(w.Boundary())  check(w.Close())}
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