MCPcopy Create free account
hub / github.com/nock/nock / MemoryReadableStream

Class MemoryReadableStream

tests/test_socket.js:79–98  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

77})
78
79class MemoryReadableStream extends Readable {
80 constructor(content) {
81 super()
82 this._content = content
83 this._currentOffset = 0
84 }
85
86 _read(size) {
87 if (this._currentOffset >= this._content.length) {
88 this.push(null)
89 return
90 }
91
92 const nextOffset = this._currentOffset + size
93 const content = this._content.slice(this._currentOffset, nextOffset)
94 this._currentOffset = nextOffset
95
96 this.push(content)
97 }
98}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected