( buf: Buffer, s: string, n: number, fub: Uint8Array, )
| 39 | // The initial contents of buf corresponds to the string s; |
| 40 | // the result is the final contents of buf returned as a string. |
| 41 | async function fillBytes( |
| 42 | buf: Buffer, |
| 43 | s: string, |
| 44 | n: number, |
| 45 | fub: Uint8Array, |
| 46 | ): Promise<string> { |
| 47 | check(buf, s); |
| 48 | for (; n > 0; n--) { |
| 49 | const m = await buf.write(fub); |
| 50 | assertEquals(m, fub.byteLength); |
| 51 | const decoder = new TextDecoder(); |
| 52 | s += decoder.decode(fub); |
| 53 | check(buf, s); |
| 54 | } |
| 55 | return s; |
| 56 | } |
| 57 | |
| 58 | // Empty buf through repeated reads into fub. |
| 59 | // The initial contents of buf corresponds to the string s. |
no test coverage detected