Skip to content

Commit b8e4177

Browse files
committedFeb 19, 2020
fs: add fs/promises alias module
PR-URL: nodejs#31553 Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Myles Borins <[email protected]> Reviewed-By: Rich Trott <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Tobias Nießen <[email protected]> Reviewed-By: Yuta Hiroto <[email protected]>
1 parent e6c2277 commit b8e4177

File tree

5 files changed

+16
-1
lines changed

5 files changed

+16
-1
lines changed
 

‎doc/api/fs.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -4237,7 +4237,7 @@ this API: [`fs.writev()`][].
42374237

42384238
The `fs.promises` API provides an alternative set of asynchronous file system
42394239
methods that return `Promise` objects rather than using callbacks. The
4240-
API is accessible via `require('fs').promises`.
4240+
API is accessible via `require('fs').promises` or `require('fs/promises')`.
42414241

42424242
### class: `FileHandle`
42434243
<!-- YAML

‎lib/fs/promises.js

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
'use strict';
2+
3+
module.exports = require('internal/fs/promises').exports;

‎node.gyp

+1
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
'lib/domain.js',
5252
'lib/events.js',
5353
'lib/fs.js',
54+
'lib/fs/promises.js',
5455
'lib/http.js',
5556
'lib/http2.js',
5657
'lib/_http_agent.js',
+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import '../common/index.mjs';
2+
import { stat } from 'fs/promises';
3+
4+
// Should not reject.
5+
stat(new URL(import.meta.url));
+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
'use strict';
2+
3+
require('../common');
4+
const assert = require('assert');
5+
6+
assert.strictEqual(require('fs/promises'), require('fs').promises);

0 commit comments

Comments
 (0)
Please sign in to comment.