MCPcopy Create free account
hub / github.com/fogleman/primitive / SaveFile

Function SaveFile

primitive/util.go:34–47  ·  view source on GitHub ↗
(path, contents string)

Source from the content-addressed store, hash-verified

32}
33
34func SaveFile(path, contents string) error {
35 if path == "-" {
36 _, err := fmt.Fprint(os.Stdout, contents)
37 return err
38 } else {
39 file, err := os.Create(path)
40 if err != nil {
41 return err
42 }
43 defer file.Close()
44 _, err = file.WriteString(contents)
45 return err
46 }
47}
48
49func SavePNG(path string, im image.Image) error {
50 file, err := os.Create(path)

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…