Skip to content

Commit

Permalink
fs: move fs.promises API to fs/promises
Browse files Browse the repository at this point in the history
PR-URL: nodejs#18777
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
  • Loading branch information
targos authored and MayaLekova committed May 8, 2018
1 parent 19eee88 commit 2b1849d
Show file tree
Hide file tree
Showing 8 changed files with 581 additions and 530 deletions.
6 changes: 3 additions & 3 deletions benchmark/fs/bench-stat-promise.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict';

const common = require('../common');
const fs = require('fs');
const fsPromises = require('fs/promises');

const bench = common.createBenchmark(main, {
n: [20e4],
Expand All @@ -10,11 +10,11 @@ const bench = common.createBenchmark(main, {

async function run(n, statType) {
const arg = statType === 'fstat' ?
await fs.promises.open(__filename, 'r') : __filename;
await fsPromises.open(__filename, 'r') : __filename;
let remaining = n;
bench.start();
while (remaining-- > 0)
await fs.promises[statType](arg);
await fsPromises[statType](arg);
bench.end(n);

if (typeof arg.close === 'function')
Expand Down
Loading

0 comments on commit 2b1849d

Please sign in to comment.