Skip to content

Commit ea7fb16

Browse files
jakecastellidanielleadams
authored andcommitted
doc: fix fs missing import
PR-URL: #46907 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Debadree Chatterjee <debadree333@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Darshan Sen <raisinten@gmail.com> Reviewed-By: Moshe Atlow <moshe@atlow.co.il> Reviewed-By: LiviaMedeiros <livia@cirno.name>
1 parent 96a39d1 commit ea7fb16

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

doc/api/async_hooks.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -375,6 +375,7 @@ The following is a simple demonstration of `triggerAsyncId`:
375375
import { createHook, executionAsyncId } from 'node:async_hooks';
376376
import { stdout } from 'node:process';
377377
import net from 'node:net';
378+
import fs from 'node:fs';
378379

379380
createHook({
380381
init(asyncId, type, triggerAsyncId) {
@@ -392,6 +393,7 @@ net.createServer((conn) => {}).listen(8080);
392393
const { createHook, executionAsyncId } = require('node:async_hooks');
393394
const { stdout } = require('node:process');
394395
const net = require('node:net');
396+
const fs = require('node:fs');
395397

396398
createHook({
397399
init(asyncId, type, triggerAsyncId) {
@@ -722,6 +724,7 @@ changes:
722724
723725
```mjs
724726
import { executionAsyncId } from 'node:async_hooks';
727+
import fs from 'node:fs';
725728

726729
console.log(executionAsyncId()); // 1 - bootstrap
727730
fs.open(path, 'r', (err, fd) => {
@@ -731,6 +734,7 @@ fs.open(path, 'r', (err, fd) => {
731734
732735
```cjs
733736
const async_hooks = require('node:async_hooks');
737+
const fs = require('node:fs');
734738

735739
console.log(async_hooks.executionAsyncId()); // 1 - bootstrap
736740
fs.open(path, 'r', (err, fd) => {

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy