MCPcopy Create free account
hub / github.com/tailscale/tailscale / writeRegular

Method writeRegular

cmd/nardump/nardump/nardump.go:117–139  ·  view source on GitHub ↗
(p string)

Source from the content-addressed store, hash-verified

115}
116
117func (nw *narWriter) writeRegular(p string) error {
118 nw.str("(")
119 nw.str("type")
120 nw.str("regular")
121 fi, err := fs.Stat(nw.fs, p)
122 if err != nil {
123 return err
124 }
125 if fi.Mode()&0111 != 0 {
126 nw.str("executable")
127 nw.str("")
128 }
129 contents, err := fs.ReadFile(nw.fs, p)
130 if err != nil {
131 return err
132 }
133 nw.str("contents")
134 if err := writeBytes(nw.w, contents); err != nil {
135 return err
136 }
137 nw.str(")")
138 return nil
139}
140
141func (nw *narWriter) writeSymlink(p string) error {
142 nw.str("(")

Callers 1

writeDirMethod · 0.95

Calls 5

strMethod · 0.95
writeBytesFunction · 0.85
ModeMethod · 0.80
StatMethod · 0.65
ReadFileMethod · 0.65

Tested by

no test coverage detected