MCPcopy Index your code
hub / github.com/bitfield/script / WriteFile

Method WriteFile

script.go:1019–1021  ·  view source on GitHub ↗

WriteFile writes the pipe's contents to the file path, truncating it if it exists, and returns the number of bytes successfully written, or an error.

(path string)

Source from the content-addressed store, hash-verified

1017// WriteFile writes the pipe's contents to the file path, truncating it if it
1018// exists, and returns the number of bytes successfully written, or an error.
1019func (p *Pipe) WriteFile(path string) (int64, error) {
1020 return p.writeOrAppendFile(path, os.O_RDWR|os.O_CREATE|os.O_TRUNC)
1021}
1022
1023func (p *Pipe) writeOrAppendFile(path string, mode int) (int64, error) {
1024 if p.Error() != nil {

Calls 1

writeOrAppendFileMethod · 0.95