MCPcopy Create free account
hub / github.com/containerd/nerdctl / Save

Method Save

mod/tigron/test/data.go:98–118  ·  view source on GitHub ↗
(value string, key ...string)

Source from the content-addressed store, hash-verified

96}
97
98func (tp *temp) Save(value string, key ...string) string {
99 tp.t.Helper()
100
101 tp.Dir(key[:len(key)-1]...)
102
103 pth := filepath.Join(append([]string{tp.tempDir}, key...)...)
104
105 err := os.WriteFile(
106 pth,
107 []byte(value),
108 FilePermissionsDefault,
109 )
110
111 assertive.ErrorIsNil(
112 assertive.WithSilentSuccess(tp.t),
113 err,
114 fmt.Sprintf("Saving file %q must succeed", pth),
115 )
116
117 return pth
118}
119
120func (tp *temp) SaveToWriter(writer func(file io.Writer) error, key ...string) string {
121 tp.t.Helper()

Callers

nothing calls this directly

Calls 3

DirMethod · 0.95
WriteFileMethod · 0.80
HelperMethod · 0.65

Tested by

no test coverage detected