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

Method Write

core/utils/cmd/cmdx.go:52–66  ·  view source on GitHub ↗
(p []byte)

Source from the content-addressed store, hash-verified

50}
51
52func (b *lockedBuffer) Write(p []byte) (int, error) {
53 b.mu.Lock()
54 defer b.mu.Unlock()
55 if b.limit > 0 && b.buf.Len() >= b.limit {
56 b.truncated += len(p)
57 return len(p), nil
58 }
59 if b.limit > 0 && b.buf.Len()+len(p) > b.limit {
60 keep := b.limit - b.buf.Len()
61 _, _ = b.buf.Write(p[:keep])
62 b.truncated += len(p) - keep
63 return len(p), nil
64 }
65 return b.buf.Write(p)
66}
67
68func (b *lockedBuffer) String() string {
69 b.mu.Lock()

Callers 4

ToIndexHtmlFunction · 0.45
HTTPDialFunction · 0.45
WriteMethod · 0.45
Md5Function · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected