mirror of
https://github.com/nodejs/node.git
synced 2025-12-28 07:50:41 +00:00
PR-URL: https://github.com/nodejs/node/pull/60763 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
27 lines
605 B
JavaScript
27 lines
605 B
JavaScript
'use strict';
|
|
const { mustCall } = require('../common');
|
|
const { Readable, Duplex } = require('stream');
|
|
const assert = require('assert');
|
|
|
|
function start(controller) {
|
|
controller.enqueue(new Uint8Array(1));
|
|
controller.close();
|
|
}
|
|
|
|
Readable.fromWeb(new ReadableStream({ start }))
|
|
.on('data', mustCall((d) => {
|
|
assert.strictEqual(d.length, 1);
|
|
}))
|
|
.on('end', mustCall())
|
|
.resume();
|
|
|
|
Duplex.fromWeb({
|
|
readable: new ReadableStream({ start }),
|
|
writable: new WritableStream({ write(chunk) {} })
|
|
})
|
|
.on('data', mustCall((d) => {
|
|
assert.strictEqual(d.length, 1);
|
|
}))
|
|
.on('end', mustCall())
|
|
.resume();
|