From 3191f30d0a4372ca40784d26e7932bf53b5306ee Mon Sep 17 00:00:00 2001 From: cjihrig Date: Thu, 3 May 2018 14:40:48 -0400 Subject: [PATCH] fs: move fs/promises to fs.promises PR-URL: https://github.com/nodejs/node/pull/20504 Refs: https://github.com/nodejs/TSC/issues/389 Reviewed-By: Rich Trott Reviewed-By: Trivikram Kamat Reviewed-By: James M Snell Reviewed-By: Myles Borins Reviewed-By: Shingo Inoue Reviewed-By: Joyee Cheung Reviewed-By: Tiancheng "Timothy" Gu Reviewed-By: Ali Ijaz Sheikh --- benchmark/fs/bench-stat-promise.js | 2 +- doc/api/fs.md | 4 ++-- lib/fs.js | 18 +++++++++++++++++- lib/{ => internal}/fs/promises.js | 5 +---- lib/internal/{fs.js => fs/utils.js} | 0 lib/internal/modules/cjs/loader.js | 2 +- lib/internal/modules/esm/default_resolve.js | 2 +- lib/internal/process/stdio.js | 2 +- node.gyp | 4 ++-- test/parallel/test-fs-filehandle.js | 2 +- test/parallel/test-fs-open-flags.js | 2 +- ...test-fs-promises-file-handle-append-file.js | 4 ++-- .../test-fs-promises-file-handle-chmod.js | 4 ++-- .../test-fs-promises-file-handle-read.js | 4 ++-- .../test-fs-promises-file-handle-readFile.js | 4 ++-- .../test-fs-promises-file-handle-stat.js | 4 ++-- .../test-fs-promises-file-handle-write.js | 4 ++-- .../test-fs-promises-file-handle-writeFile.js | 4 ++-- test/parallel/test-fs-promises-readfile.js | 2 +- test/parallel/test-fs-promises-writefile.js | 2 +- test/parallel/test-fs-promises.js | 2 +- test/parallel/test-fs-syncwritestream.js | 4 ++-- .../test-internal-fs-syncwritestream.js | 2 +- test/parallel/test-internal-fs.js | 2 +- test/sequential/test-async-wrap-getasyncid.js | 2 +- 25 files changed, 50 insertions(+), 37 deletions(-) rename lib/{ => internal}/fs/promises.js (99%) rename lib/internal/{fs.js => fs/utils.js} (100%) diff --git a/benchmark/fs/bench-stat-promise.js b/benchmark/fs/bench-stat-promise.js index b0317455728b46..96c7058fa6218a 100644 --- a/benchmark/fs/bench-stat-promise.js +++ b/benchmark/fs/bench-stat-promise.js @@ -1,7 +1,7 @@ 'use strict'; const common = require('../common'); -const fsPromises = require('fs/promises'); +const fsPromises = require('fs').promises; const bench = common.createBenchmark(main, { n: [20e4], diff --git a/doc/api/fs.md b/doc/api/fs.md index bace6d94836c23..30d6729d48c13d 100644 --- a/doc/api/fs.md +++ b/doc/api/fs.md @@ -3382,9 +3382,9 @@ Synchronous versions of [`fs.write()`][]. Returns the number of bytes written. > Stability: 1 - Experimental -The `fs/promises` API provides an alternative set of asynchronous file system +The `fs.promises` API provides an alternative set of asynchronous file system methods that return `Promise` objects rather than using callbacks. The -API is accessible via `require('fs/promises')`. +API is accessible via `require('fs').promises`. ### class: FileHandle