From c594d15170e6664c0609d317a9a201f34e875900 Mon Sep 17 00:00:00 2001 From: Сковорода Никита Андреевич Date: Sun, 6 May 2018 12:13:56 +0300 Subject: fs: drop duplicate API in promises mode This drops exporting duplicate methods that accept FileHandle as the first argument (to mirror callback-based methods accepting 'fd'). Those methods were not adding actual value to the API because all of those are already present as FileHandle methods, and they would probably be confusing to the new users and making docs harder to read. Also, the API was a bit inconsistent and lacked .close(handle). Fixes: https://github.com/nodejs/node/issues/20548 PR-URL: https://github.com/nodejs/node/pull/20559 Reviewed-By: Matteo Collina Reviewed-By: Franziska Hinkelmann Reviewed-By: James M Snell Reviewed-By: Benjamin Gruenbaum Reviewed-By: Tiancheng "Timothy" Gu Reviewed-By: Colin Ihrig Reviewed-By: Joyee Cheung Reviewed-By: Ruben Bridgewater --- benchmark/fs/bench-stat-promise.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'benchmark') diff --git a/benchmark/fs/bench-stat-promise.js b/benchmark/fs/bench-stat-promise.js index 96c7058fa6..99a5da5799 100644 --- a/benchmark/fs/bench-stat-promise.js +++ b/benchmark/fs/bench-stat-promise.js @@ -9,12 +9,12 @@ const bench = common.createBenchmark(main, { }); async function run(n, statType) { - const arg = statType === 'fstat' ? - await fsPromises.open(__filename, 'r') : __filename; + const handleMode = statType === 'fstat'; + const arg = handleMode ? await fsPromises.open(__filename, 'r') : __filename; let remaining = n; bench.start(); while (remaining-- > 0) - await fsPromises[statType](arg); + await (handleMode ? arg.stat() : fsPromises[statType](arg)); bench.end(n); if (typeof arg.close === 'function') -- cgit v1.2.3