@@ -248,6 +248,7 @@ const transformedStream = stream.pipeThrough(transform);
248248
249249for await (const chunk of transformedStream)
250250 console .log (chunk);
251+ // Prints: A
251252```
252253
253254``` cjs
@@ -273,6 +274,7 @@ const transformedStream = stream.pipeThrough(transform);
273274(async () => {
274275 for await (const chunk of transformedStream)
275276 console .log (chunk);
277+ // Prints: A
276278})();
277279```
278280
@@ -410,7 +412,7 @@ async function* asyncIterableGenerator() {
410412const stream = ReadableStream .from (asyncIterableGenerator ());
411413
412414for await (const chunk of stream)
413- console .log (chunk); // Prints 'a', 'b', 'c'
415+ console .log (chunk); // Prints: 'a', 'b', 'c'
414416```
415417
416418``` cjs
@@ -426,7 +428,7 @@ async function* asyncIterableGenerator() {
426428 const stream = ReadableStream .from (asyncIterableGenerator ());
427429
428430 for await (const chunk of stream)
429- console .log (chunk); // Prints 'a', 'b', 'c'
431+ console .log (chunk); // Prints: 'a', 'b', 'c'
430432})();
431433```
432434
@@ -1520,6 +1522,7 @@ const dataArray = encoder.encode('hello world from consumers!');
15201522const readable = Readable .from (dataArray);
15211523const data = await arrayBuffer (readable);
15221524console .log (` from readable: ${ data .byteLength } ` );
1525+ // Prints: from readable: 76
15231526` ` `
15241527
15251528` ` ` cjs
@@ -1532,6 +1535,7 @@ const dataArray = encoder.encode('hello world from consumers!');
15321535const readable = Readable .from (dataArray);
15331536arrayBuffer (readable).then ((data ) => {
15341537 console .log (` from readable: ${ data .byteLength } ` );
1538+ // Prints: from readable: 76
15351539});
15361540` ` `
15371541
@@ -1553,6 +1557,7 @@ const dataBlob = new Blob(['hello world from consumers!']);
15531557const readable = dataBlob .stream ();
15541558const data = await blob (readable);
15551559console .log (` from readable: ${ data .size } ` );
1560+ // Prints: from readable: 27
15561561` ` `
15571562
15581563` ` ` cjs
@@ -1563,6 +1568,7 @@ const dataBlob = new Blob(['hello world from consumers!']);
15631568const readable = dataBlob .stream ();
15641569blob (readable).then ((data ) => {
15651570 console .log (` from readable: ${ data .size } ` );
1571+ // Prints: from readable: 27
15661572});
15671573` ` `
15681574
@@ -1586,6 +1592,7 @@ const dataBuffer = Buffer.from('hello world from consumers!');
15861592const readable = Readable .from (dataBuffer);
15871593const data = await buffer (readable);
15881594console .log (` from readable: ${ data .length } ` );
1595+ // Prints: from readable: 27
15891596` ` `
15901597
15911598` ` ` cjs
@@ -1598,6 +1605,7 @@ const dataBuffer = Buffer.from('hello world from consumers!');
15981605const readable = Readable .from (dataBuffer);
15991606buffer (readable).then ((data ) => {
16001607 console .log (` from readable: ${ data .length } ` );
1608+ // Prints: from readable: 27
16011609});
16021610` ` `
16031611
@@ -1627,6 +1635,7 @@ const items = Array.from(
16271635const readable = Readable .from (JSON .stringify (items));
16281636const data = await json (readable);
16291637console .log (` from readable: ${ data .length } ` );
1638+ // Prints: from readable: 100
16301639` ` `
16311640
16321641` ` ` cjs
@@ -1645,6 +1654,7 @@ const items = Array.from(
16451654const readable = Readable .from (JSON .stringify (items));
16461655json (readable).then ((data ) => {
16471656 console .log (` from readable: ${ data .length } ` );
1657+ // Prints: from readable: 100
16481658});
16491659` ` `
16501660
@@ -1665,6 +1675,7 @@ import { Readable } from 'node:stream';
16651675const readable = Readable .from (' Hello world from consumers!' );
16661676const data = await text (readable);
16671677console .log (` from readable: ${ data .length } ` );
1678+ // Prints: from readable: 27
16681679` ` `
16691680
16701681` ` ` cjs
@@ -1674,6 +1685,7 @@ const { Readable } = require('node:stream');
16741685const readable = Readable .from (' Hello world from consumers!' );
16751686text (readable).then ((data ) => {
16761687 console .log (` from readable: ${ data .length } ` );
1688+ // Prints: from readable: 27
16771689});
16781690` ` `
16791691
0 commit comments