MCPcopy Create free account
hub / github.com/1Panel-dev/1Panel / writeFile

Function writeFile

core/cmd/server/cmd/app.go:130–141  ·  view source on GitHub ↗
(filePath string, in io.Reader)

Source from the content-addressed store, hash-verified

128}
129
130func writeFile(filePath string, in io.Reader) error {
131 data, err := io.ReadAll(in)
132 if err != nil {
133 fmt.Println(i18n.GetMsgWithMapForCmd("AppWriteErr", map[string]interface{}{"name": filePath, "err": err.Error()}))
134 return err
135 }
136 if err := os.WriteFile(filePath, data, 0755); err != nil {
137 fmt.Println(i18n.GetMsgWithMapForCmd("AppWriteErr", map[string]interface{}{"name": filePath, "err": err.Error()}))
138 return err
139 }
140 return nil
141}
142
143func loadAppHelper() {
144 fmt.Println(i18n.GetMsgByKeyForCmd("AppCommands"))

Callers 1

app.goFile · 0.85

Calls 2

WriteFileMethod · 0.80
ErrorMethod · 0.45

Tested by

no test coverage detected