MCPcopy
hub / github.com/bitfield/script / EncodeBase64

Method EncodeBase64

script.go:375–385  ·  view source on GitHub ↗

EncodeBase64 produces the base64 encoding of the input.

()

Source from the content-addressed store, hash-verified

373
374// EncodeBase64 produces the base64 encoding of the input.
375func (p *Pipe) EncodeBase64() *Pipe {
376 return p.Filter(func(r io.Reader, w io.Writer) error {
377 encoder := base64.NewEncoder(base64.StdEncoding, w)
378 defer encoder.Close()
379 _, err := io.Copy(encoder, r)
380 if err != nil {
381 return err
382 }
383 return nil
384 })
385}
386
387func (p *Pipe) environment() []string {
388 p.mu.Lock()

Calls 2

FilterMethod · 0.95
CloseMethod · 0.45