Skip to content

Commit d2b934c

Browse files
authored
Update discover-promises-in-nodejs.md
Signed-off-by: Vishal Kumar Gupta <groupsvkg@gmail.com>
1 parent 232e7f1 commit d2b934c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

apps/site/pages/en/learn/asynchronous-work/discover-promises-in-nodejs.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,13 +159,13 @@ Node.js provides **Promise-based versions** of many of its core APIs, especially
159159
For example, the `fs` (file system) module has a Promise-based API under `fs.promises`:
160160

161161
```js
162-
const fs = require('node:fs').promises;
162+
const fs = require('node:fs');
163163
// Or, you can import the promisified version directly:
164164
// const fs = require('node:fs/promises');
165165

166166
async function readFile() {
167167
try {
168-
const data = await fs.readFile('example.txt', 'utf8');
168+
const data = await fs.promises.readFile('example.txt', 'utf8');
169169
console.log(data);
170170
} catch (err) {
171171
console.error('Error reading file:', err);

0 commit comments

Comments
 (0)