summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/api/child_process.md10
1 files changed, 10 insertions, 0 deletions
diff --git a/doc/api/child_process.md b/doc/api/child_process.md
index c822864c65..f001ee3c76 100644
--- a/doc/api/child_process.md
+++ b/doc/api/child_process.md
@@ -1398,6 +1398,16 @@ then this will be `null`.
`subprocess.stdout` is an alias for `subprocess.stdio[1]`. Both properties will
refer to the same value.
+```js
+const { spawn } = require('child_process');
+
+const subprocess = spawn('ls');
+
+subprocess.stdout.on('data', (data) => {
+ console.log(`Received chunk ${data}`);
+});
+```
+
### subprocess.unref()
<!-- YAML
added: v0.7.10