Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 68c5ee4

Browse filesBrowse files
richardlauMylesBorins
authored andcommitted
doc: update fs promise-based examples
#34843 was cherry-picked onto `v12.x-staging` in 961844d but the `fs/promises` API, as used in the examples, is only available from Node.js 14. Change the added examples to use `require(fs).promises` instead. PR-URL: #35760 Fixes: #35740 Refs: #34843 Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com> Reviewed-By: Ricky Zhou <0x19951125@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Anto Aravinth <anto.aravinth.cse@gmail.com>
1 parent 0f757bc commit 68c5ee4
Copy full SHA for 68c5ee4

File tree

Expand file treeCollapse file tree

1 file changed

+2
-2
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+2
-2
lines changed
Open diff view settings
Collapse file

‎doc/api/fs.md‎

Copy file name to clipboardExpand all lines: doc/api/fs.md
+2-2Lines changed: 2 additions & 2 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ Promise-based operations return a `Promise` that is resolved when the
6060
asynchronous operation is complete.
6161

6262
```js
63-
const fs = require('fs/promises');
63+
const fs = require('fs').promises;
6464

6565
(async function(path) {
6666
try {
@@ -106,7 +106,7 @@ fs.rename('/tmp/hello', '/tmp/world', (err) => {
106106
Or, use the promise-based API:
107107

108108
```js
109-
const fs = require('fs/promises');
109+
const fs = require('fs').promises;
110110

111111
(async function(from, to) {
112112
try {

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.