EncodeBase64 produces the base64 encoding of the input.
()
| 373 | |
| 374 | // EncodeBase64 produces the base64 encoding of the input. |
| 375 | func (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 | |
| 387 | func (p *Pipe) environment() []string { |
| 388 | p.mu.Lock() |