-
Notifications
You must be signed in to change notification settings - Fork 30k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
doc: add print results for examples in WebStreams
#49143
doc: add print results for examples in WebStreams
#49143
Conversation
doc/api/webstreams.md
Outdated
@@ -248,6 +248,7 @@ const transformedStream = stream.pipeThrough(transform); | |||
|
|||
for await (const chunk of transformedStream) | |||
console.log(chunk); | |||
// Prints A |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// Prints A | |
// Prints: A |
doc/api/webstreams.md
Outdated
@@ -273,6 +274,7 @@ const transformedStream = stream.pipeThrough(transform); | |||
(async () => { | |||
for await (const chunk of transformedStream) | |||
console.log(chunk); | |||
// Prints A |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// Prints A | |
// Prints: A |
doc/api/webstreams.md
Outdated
@@ -1520,6 +1522,7 @@ const dataArray = encoder.encode('hello world from consumers!'); | |||
const readable = Readable.from(dataArray); | |||
const data = await arrayBuffer(readable); | |||
console.log(`from readable: ${data.byteLength}`); | |||
// Prints from readable: 76 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// Prints from readable: 76 | |
// Prints: from readable: 76 |
doc/api/webstreams.md
Outdated
@@ -1532,6 +1535,7 @@ const dataArray = encoder.encode('hello world from consumers!'); | |||
const readable = Readable.from(dataArray); | |||
arrayBuffer(readable).then((data) => { | |||
console.log(`from readable: ${data.byteLength}`); | |||
// Prints from readable: 76 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// Prints from readable: 76 | |
// Prints: from readable: 76 |
doc/api/webstreams.md
Outdated
@@ -1553,6 +1557,7 @@ const dataBlob = new Blob(['hello world from consumers!']); | |||
const readable = dataBlob.stream(); | |||
const data = await blob(readable); | |||
console.log(`from readable: ${data.size}`); | |||
// Prints from readable: 27 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// Prints from readable: 27 | |
// Prints: from readable: 27 |
doc/api/webstreams.md
Outdated
@@ -1598,6 +1605,7 @@ const dataBuffer = Buffer.from('hello world from consumers!'); | |||
const readable = Readable.from(dataBuffer); | |||
buffer(readable).then((data) => { | |||
console.log(`from readable: ${data.length}`); | |||
// Prints from readable: 27 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// Prints from readable: 27 | |
// Prints: from readable: 27 |
doc/api/webstreams.md
Outdated
@@ -1627,6 +1635,7 @@ const items = Array.from( | |||
const readable = Readable.from(JSON.stringify(items)); | |||
const data = await json(readable); | |||
console.log(`from readable: ${data.length}`); | |||
// Prints from readable: 100 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// Prints from readable: 100 | |
// Prints: from readable: 100 |
doc/api/webstreams.md
Outdated
@@ -1645,6 +1654,7 @@ const items = Array.from( | |||
const readable = Readable.from(JSON.stringify(items)); | |||
json(readable).then((data) => { | |||
console.log(`from readable: ${data.length}`); | |||
// Prints from readable: 100 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// Prints from readable: 100 | |
// Prints: from readable: 100 |
doc/api/webstreams.md
Outdated
@@ -1665,6 +1675,7 @@ import { Readable } from 'node:stream'; | |||
const readable = Readable.from('Hello world from consumers!'); | |||
const data = await text(readable); | |||
console.log(`from readable: ${data.length}`); | |||
// Prints from readable: 27 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// Prints from readable: 27 | |
// Prints: from readable: 27 |
doc/api/webstreams.md
Outdated
@@ -1674,6 +1685,7 @@ const { Readable } = require('node:stream'); | |||
const readable = Readable.from('Hello world from consumers!'); | |||
text(readable).then((data) => { | |||
console.log(`from readable: ${data.length}`); | |||
// Prints from readable: 27 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// Prints from readable: 27 | |
// Prints: from readable: 27 |
|
@lpinca Hi, thank you for your opinion. |
Landed in 9a2e6bc |
PR-URL: #49143 Reviewed-By: Antoine du Hamel <[email protected]> Reviewed-By: Deokjin Kim <[email protected]> Reviewed-By: Luigi Pinca <[email protected]>
PR-URL: nodejs#49143 Reviewed-By: Antoine du Hamel <[email protected]> Reviewed-By: Deokjin Kim <[email protected]> Reviewed-By: Luigi Pinca <[email protected]>
PR-URL: nodejs#49143 Reviewed-By: Antoine du Hamel <[email protected]> Reviewed-By: Deokjin Kim <[email protected]> Reviewed-By: Luigi Pinca <[email protected]>
PR-URL: #49143 Reviewed-By: Antoine du Hamel <[email protected]> Reviewed-By: Deokjin Kim <[email protected]> Reviewed-By: Luigi Pinca <[email protected]>
PR-URL: #49143 Reviewed-By: Antoine du Hamel <[email protected]> Reviewed-By: Deokjin Kim <[email protected]> Reviewed-By: Luigi Pinca <[email protected]>
PR-URL: #49326 Refs: #49143 Reviewed-By: Antoine du Hamel <[email protected]> Reviewed-By: Deokjin Kim <[email protected]> Reviewed-By: Luigi Pinca <[email protected]>
PR-URL: #49326 Refs: #49143 Reviewed-By: Antoine du Hamel <[email protected]> Reviewed-By: Deokjin Kim <[email protected]> Reviewed-By: Luigi Pinca <[email protected]>
PR-URL: nodejs#49326 Refs: nodejs#49143 Reviewed-By: Antoine du Hamel <[email protected]> Reviewed-By: Deokjin Kim <[email protected]> Reviewed-By: Luigi Pinca <[email protected]>
PR-URL: #49326 Refs: #49143 Reviewed-By: Antoine du Hamel <[email protected]> Reviewed-By: Deokjin Kim <[email protected]> Reviewed-By: Luigi Pinca <[email protected]>
PR-URL: nodejs/node#49326 Refs: nodejs/node#49143 Reviewed-By: Antoine du Hamel <[email protected]> Reviewed-By: Deokjin Kim <[email protected]> Reviewed-By: Luigi Pinca <[email protected]>
PR-URL: nodejs/node#49326 Refs: nodejs/node#49143 Reviewed-By: Antoine du Hamel <[email protected]> Reviewed-By: Deokjin Kim <[email protected]> Reviewed-By: Luigi Pinca <[email protected]>
As with the other examples, I added something about the resulting output.(Only output results that do not change)