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

Method Bytes

script.go:220–229  ·  view source on GitHub ↗

Bytes returns the contents of the pipe as a []byte, or an error.

()

Source from the content-addressed store, hash-verified

218
219// Bytes returns the contents of the pipe as a []byte, or an error.
220func (p *Pipe) Bytes() ([]byte, error) {
221 if p.Error() != nil {
222 return nil, p.Error()
223 }
224 data, err := io.ReadAll(p)
225 if err != nil {
226 p.SetError(err)
227 }
228 return data, p.Error()
229}
230
231// Close closes the pipe's associated reader. This is a no-op if the reader is
232// not an [io.Closer].

Calls 2

ErrorMethod · 0.95
SetErrorMethod · 0.95