xref: /third_party/node/test/parallel/test-stream-await-drain-writers-in-synchronously-recursion-write.js
  • Home
  • History
  • Annotate Annotate
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
  • only in /third_party/node/test/parallel/
11cb0ef41Sopenharmony_ci'use strict';
21cb0ef41Sopenharmony_ciconst common = require('../common');
31cb0ef41Sopenharmony_ciconst { PassThrough } = require('stream');
41cb0ef41Sopenharmony_ci
51cb0ef41Sopenharmony_ciconst encode = new PassThrough({
61cb0ef41Sopenharmony_ci  highWaterMark: 1
71cb0ef41Sopenharmony_ci});
81cb0ef41Sopenharmony_ci
91cb0ef41Sopenharmony_ciconst decode = new PassThrough({
101cb0ef41Sopenharmony_ci  highWaterMark: 1
111cb0ef41Sopenharmony_ci});
121cb0ef41Sopenharmony_ci
131cb0ef41Sopenharmony_ciconst send = common.mustCall((buf) => {
141cb0ef41Sopenharmony_ci  encode.write(buf);
151cb0ef41Sopenharmony_ci}, 4);
161cb0ef41Sopenharmony_ci
171cb0ef41Sopenharmony_cilet i = 0;
181cb0ef41Sopenharmony_ciconst onData = common.mustCall(() => {
191cb0ef41Sopenharmony_ci  if (++i === 2) {
201cb0ef41Sopenharmony_ci    send(Buffer.from([0x3]));
211cb0ef41Sopenharmony_ci    send(Buffer.from([0x4]));
221cb0ef41Sopenharmony_ci  }
231cb0ef41Sopenharmony_ci}, 4);
241cb0ef41Sopenharmony_ci
251cb0ef41Sopenharmony_ciencode.pipe(decode).on('data', onData);
261cb0ef41Sopenharmony_ci
271cb0ef41Sopenharmony_cisend(Buffer.from([0x1]));
281cb0ef41Sopenharmony_cisend(Buffer.from([0x2]));
29

Indexes created Thu Nov 07 10:32:03 CST 2024