MCPcopy Create free account
hub / github.com/denoland/std / fillBytes

Function fillBytes

io/buffer_test.ts:41–56  ·  view source on GitHub ↗
(
  buf: Buffer,
  s: string,
  n: number,
  fub: Uint8Array,
)

Source from the content-addressed store, hash-verified

39// The initial contents of buf corresponds to the string s;
40// the result is the final contents of buf returned as a string.
41async 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.

Callers 1

buffer_test.tsFile · 0.85

Calls 3

assertEqualsFunction · 0.90
checkFunction · 0.70
writeMethod · 0.65

Tested by

no test coverage detected