MCPcopy
hub / github.com/nats-io/nats.go / Size

Method Size

nats.go:842–848  ·  view source on GitHub ↗

Size returns a message size in bytes.

()

Source from the content-addressed store, hash-verified

840
841// Size returns a message size in bytes.
842func (m *Msg) Size() int {
843 if m.wsz != 0 {
844 return m.wsz
845 }
846 hdr, _ := m.headerBytes()
847 return len(m.Subject) + len(m.Reply) + len(hdr) + len(m.Data)
848}
849
850func (m *Msg) headerBytes() ([]byte, error) {
851 var hdr []byte

Callers

nothing calls this directly

Calls 1

headerBytesMethod · 0.95

Tested by

no test coverage detected