MCPcopy Create free account
hub / github.com/Unpackerr/unpackerr / writeFile

Function writeFile

init/config/main.go:219–229  ·  view source on GitHub ↗

This is used only by compose and config. docs has it's own.

(dir, output string, buf *bytes.Buffer)

Source from the content-addressed store, hash-verified

217
218// This is used only by compose and config. docs has it's own.
219func writeFile(dir, output string, buf *bytes.Buffer) {
220 _ = os.Mkdir(dir, dirMode)
221 filePath := filepath.Join(dir, output)
222 log.Printf("Writing: %s, size: %d", filePath, buf.Len())
223 buf.WriteString("## => Content Auto Generated, " +
224 strings.ToUpper(time.Now().UTC().Round(time.Second).Format("02 Jan 2006 15:04 UTC")+"\n"))
225
226 if err := os.WriteFile(filePath, buf.Bytes(), fileMode); err != nil {
227 log.Fatalln(err)
228 }
229}

Callers 2

createComposeFunction · 0.85
createConfFileFunction · 0.85

Calls 1

PrintfMethod · 0.65

Tested by

no test coverage detected