MCPcopy
hub / github.com/pocketbase/pocketbase / prependToEmptyFile

Function prependToEmptyFile

plugins/jsvm/jsvm.go:521–529  ·  view source on GitHub ↗

prependToEmptyFile prepends the specified text to an empty file. If the file is not empty this method does nothing.

(path, text string)

Source from the content-addressed store, hash-verified

519//
520// If the file is not empty this method does nothing.
521func prependToEmptyFile(path, text string) error {
522 info, err := os.Stat(path)
523
524 if err == nil && info.Size() == 0 {
525 return os.WriteFile(path, []byte(text), 0644)
526 }
527
528 return err
529}
530
531// filesContent returns a map with all direct files within the specified dir and their content.
532//

Callers 1

registerHooksMethod · 0.85

Calls 1

SizeMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…