Function
makeReadableStream
(chunk = 'chunk', n = 10, timeout = 100)
Source from the content-addressed store, hash-verified
| 185 | }; |
| 186 | |
| 187 | export const makeReadableStream = (chunk = 'chunk', n = 10, timeout = 100) => { |
| 188 | return new ReadableStream( |
| 189 | { |
| 190 | async pull(controller) { |
| 191 | await setTimeoutAsync(timeout); |
| 192 | n-- ? controller.enqueue(chunk) : controller.close(); |
| 193 | }, |
| 194 | }, |
| 195 | { |
| 196 | highWaterMark: 1, |
| 197 | } |
| 198 | ); |
| 199 | }; |
| 200 | |
| 201 | export const makeEchoStream = (echo) => |
| 202 | new WritableStream({ |
Tested by
no test coverage detected