@@ -248,6 +248,7 @@ const transformedStream = stream.pipeThrough(transform);
248
248
249
249
for await (const chunk of transformedStream)
250
250
console .log (chunk);
251
+ // Prints: A
251
252
```
252
253
253
254
``` cjs
@@ -273,6 +274,7 @@ const transformedStream = stream.pipeThrough(transform);
273
274
(async () => {
274
275
for await (const chunk of transformedStream)
275
276
console .log (chunk);
277
+ // Prints: A
276
278
})();
277
279
```
278
280
@@ -410,7 +412,7 @@ async function* asyncIterableGenerator() {
410
412
const stream = ReadableStream .from (asyncIterableGenerator ());
411
413
412
414
for await (const chunk of stream)
413
- console .log (chunk); // Prints 'a', 'b', 'c'
415
+ console .log (chunk); // Prints: 'a', 'b', 'c'
414
416
```
415
417
416
418
``` cjs
@@ -426,7 +428,7 @@ async function* asyncIterableGenerator() {
426
428
const stream = ReadableStream .from (asyncIterableGenerator ());
427
429
428
430
for await (const chunk of stream)
429
- console .log (chunk); // Prints 'a', 'b', 'c'
431
+ console .log (chunk); // Prints: 'a', 'b', 'c'
430
432
})();
431
433
```
432
434
@@ -1520,6 +1522,7 @@ const dataArray = encoder.encode('hello world from consumers!');
1520
1522
const readable = Readable .from (dataArray);
1521
1523
const data = await arrayBuffer (readable);
1522
1524
console .log (` from readable: ${ data .byteLength } ` );
1525
+ // Prints: from readable: 76
1523
1526
` ` `
1524
1527
1525
1528
` ` ` cjs
@@ -1532,6 +1535,7 @@ const dataArray = encoder.encode('hello world from consumers!');
1532
1535
const readable = Readable .from (dataArray);
1533
1536
arrayBuffer (readable).then ((data ) => {
1534
1537
console .log (` from readable: ${ data .byteLength } ` );
1538
+ // Prints: from readable: 76
1535
1539
});
1536
1540
` ` `
1537
1541
@@ -1553,6 +1557,7 @@ const dataBlob = new Blob(['hello world from consumers!']);
1553
1557
const readable = dataBlob .stream ();
1554
1558
const data = await blob (readable);
1555
1559
console .log (` from readable: ${ data .size } ` );
1560
+ // Prints: from readable: 27
1556
1561
` ` `
1557
1562
1558
1563
` ` ` cjs
@@ -1563,6 +1568,7 @@ const dataBlob = new Blob(['hello world from consumers!']);
1563
1568
const readable = dataBlob .stream ();
1564
1569
blob (readable).then ((data ) => {
1565
1570
console .log (` from readable: ${ data .size } ` );
1571
+ // Prints: from readable: 27
1566
1572
});
1567
1573
` ` `
1568
1574
@@ -1586,6 +1592,7 @@ const dataBuffer = Buffer.from('hello world from consumers!');
1586
1592
const readable = Readable .from (dataBuffer);
1587
1593
const data = await buffer (readable);
1588
1594
console .log (` from readable: ${ data .length } ` );
1595
+ // Prints: from readable: 27
1589
1596
` ` `
1590
1597
1591
1598
` ` ` cjs
@@ -1598,6 +1605,7 @@ const dataBuffer = Buffer.from('hello world from consumers!');
1598
1605
const readable = Readable .from (dataBuffer);
1599
1606
buffer (readable).then ((data ) => {
1600
1607
console .log (` from readable: ${ data .length } ` );
1608
+ // Prints: from readable: 27
1601
1609
});
1602
1610
` ` `
1603
1611
@@ -1627,6 +1635,7 @@ const items = Array.from(
1627
1635
const readable = Readable .from (JSON .stringify (items));
1628
1636
const data = await json (readable);
1629
1637
console .log (` from readable: ${ data .length } ` );
1638
+ // Prints: from readable: 100
1630
1639
` ` `
1631
1640
1632
1641
` ` ` cjs
@@ -1645,6 +1654,7 @@ const items = Array.from(
1645
1654
const readable = Readable .from (JSON .stringify (items));
1646
1655
json (readable).then ((data ) => {
1647
1656
console .log (` from readable: ${ data .length } ` );
1657
+ // Prints: from readable: 100
1648
1658
});
1649
1659
` ` `
1650
1660
@@ -1665,6 +1675,7 @@ import { Readable } from 'node:stream';
1665
1675
const readable = Readable .from (' Hello world from consumers!' );
1666
1676
const data = await text (readable);
1667
1677
console .log (` from readable: ${ data .length } ` );
1678
+ // Prints: from readable: 27
1668
1679
` ` `
1669
1680
1670
1681
` ` ` cjs
@@ -1674,6 +1685,7 @@ const { Readable } = require('node:stream');
1674
1685
const readable = Readable .from (' Hello world from consumers!' );
1675
1686
text (readable).then ((data ) => {
1676
1687
console .log (` from readable: ${ data .length } ` );
1688
+ // Prints: from readable: 27
1677
1689
});
1678
1690
` ` `
1679
1691
0 commit comments