MCPcopy
hub / github.com/rvagg/through2 / classicByteTransform

Function classicByteTransform

test/test.js:59–74  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

57}
58
59export async function classicByteTransform () {
60 const stream = transform(function (chunk, _enc, cb) {
61 if (!this._i) this._i = 97
62 else this._i++
63 const out = new Uint8Array(chunk.length)
64 out.fill(this._i)
65 this.push(out)
66 cb()
67 })
68 const done = collect(stream)
69 stream.write(randomBytes(10))
70 stream.write(randomBytes(5))
71 stream.write(randomBytes(10))
72 stream.end()
73 eq(decoder.decode(await done), 'aaaaaaaaaabbbbbcccccccccc')
74}
75
76export async function classicNoopTransform () {
77 const stream = transform()

Callers

nothing calls this directly

Calls 4

transformFunction · 0.90
randomBytesFunction · 0.85
collectFunction · 0.70
eqFunction · 0.70

Tested by

no test coverage detected