• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1'use strict';
2
3const common = require('../common');
4
5// The following tests validate base functionality for the fs.promises
6// FileHandle.stat method.
7
8const { open } = require('fs').promises;
9const path = require('path');
10const tmpdir = require('../common/tmpdir');
11const assert = require('assert');
12
13tmpdir.refresh();
14
15async function validateStat() {
16  const filePath = path.resolve(tmpdir.path, 'tmp-read-file.txt');
17  const fileHandle = await open(filePath, 'w+');
18  const stats = await fileHandle.stat();
19  assert.ok(stats.mtime instanceof Date);
20  await fileHandle.close();
21}
22
23validateStat()
24  .then(common.mustCall());
25