| 77 | }) |
| 78 | |
| 79 | class 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 | } |
nothing calls this directly
no outgoing calls
no test coverage detected