summaryrefslogtreecommitdiff
path: root/benchmark
diff options
context:
space:
mode:
authorСковорода Никита Андреевич <chalkerx@gmail.com>2018-05-06 12:13:56 +0300
committerСковорода Никита Андреевич <chalkerx@gmail.com>2018-05-19 11:04:28 +0300
commitc594d15170e6664c0609d317a9a201f34e875900 (patch)
treedd8b62eccab6545e91924ce0132a7537a5b802b0 /benchmark
parent064057b7ad0ee6f76f43846b4f002072dafa1702 (diff)
downloadandroid-node-v8-c594d15170e6664c0609d317a9a201f34e875900.tar.gz
android-node-v8-c594d15170e6664c0609d317a9a201f34e875900.tar.bz2
android-node-v8-c594d15170e6664c0609d317a9a201f34e875900.zip
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 <matteo.collina@gmail.com> Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Diffstat (limited to 'benchmark')
-rw-r--r--benchmark/fs/bench-stat-promise.js6
1 files changed, 3 insertions, 3 deletions
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')