Skip to content

Commit 68c5ee4

Browse 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 <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Franziska Hinkelmann <[email protected]> Reviewed-By: Ricky Zhou <[email protected]> Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: Anto Aravinth <[email protected]>
1 parent 0f757bc commit 68c5ee4

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

doc/api/fs.md

+2-2
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)