MCPcopy Create free account
hub / github.com/middleapi/orpc / feed

Method feed

packages/standard-server/src/event-iterator/decoder.ts:62–81  ·  view source on GitHub ↗
(chunk: string)

Source from the content-addressed store, hash-verified

60 }
61
62 feed(chunk: string): void {
63 this.incomplete += chunk
64
65 const lastCompleteIndex = this.incomplete.lastIndexOf('\n\n')
66
67 if (lastCompleteIndex === -1) {
68 return
69 }
70
71 const completes = this.incomplete.slice(0, lastCompleteIndex).split(/\n\n/)
72 this.incomplete = this.incomplete.slice(lastCompleteIndex + 2)
73
74 for (const encoded of completes) {
75 const message = decodeEventMessage(`${encoded}\n\n`)
76
77 if (this.options.onEvent) {
78 this.options.onEvent(message)
79 }
80 }
81 }
82
83 end(): void {
84 if (this.incomplete) {

Callers 2

transformMethod · 0.80
decoder.test.tsFile · 0.80

Calls 1

decodeEventMessageFunction · 0.85

Tested by

no test coverage detected