From ea7fb16e5c4802016fda9164d668b4bbfe086f7b Mon Sep 17 00:00:00 2001 From: jakecastelli <38635403+jakecastelli@users.noreply.github.com> Date: Sat, 4 Mar 2023 10:16:12 +1030 Subject: [PATCH] doc: fix fs missing import PR-URL: https://github.com/nodejs/node/pull/46907 Reviewed-By: James M Snell Reviewed-By: Debadree Chatterjee Reviewed-By: Colin Ihrig Reviewed-By: Darshan Sen Reviewed-By: Moshe Atlow Reviewed-By: LiviaMedeiros --- doc/api/async_hooks.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/doc/api/async_hooks.md b/doc/api/async_hooks.md index eb6af648c10e36..59b2284f295ee6 100644 --- a/doc/api/async_hooks.md +++ b/doc/api/async_hooks.md @@ -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) { @@ -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) { @@ -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) => { @@ -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) => {