Skip to content

Commit

Permalink
doc: fix fs missing import
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
jakecastelli authored and targos committed Mar 13, 2023
1 parent 3644d9d commit ddc18fc
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions doc/api/async_hooks.md
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,7 @@ The following is a simple demonstration of `triggerAsyncId`:
import { createHook, executionAsyncId } from 'node:async_hooks';
import { stdout } from 'node:process';
import net from 'node:net';
import fs from 'node:fs';

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

createHook({
init(asyncId, type, triggerAsyncId) {
Expand Down Expand Up @@ -722,6 +724,7 @@ changes:
```mjs
import { executionAsyncId } from 'node:async_hooks';
import fs from 'node:fs';

console.log(executionAsyncId()); // 1 - bootstrap
fs.open(path, 'r', (err, fd) => {
Expand All @@ -731,6 +734,7 @@ fs.open(path, 'r', (err, fd) => {
```cjs
const async_hooks = require('node:async_hooks');
const fs = require('node:fs');

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

0 comments on commit ddc18fc

Please sign in to comment.