Skip to content

Commit a948dc0

Browse files
committed
Use promisfied fs API from lib/fs
1 parent e125aa2 commit a948dc0

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

lib/util/utimes.js

+4-9
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
'use strict'
22

3-
const fs = require('graceful-fs')
4-
const { promisify } = require('util')
5-
6-
const open = promisify(fs.open)
7-
const futimes = promisify(fs.futimes)
8-
const close = promisify(fs.close)
3+
const fs = require('../fs')
94

105
// TODO: remove `utimesMillis` once all internal usage has switched to the Promise-based `utimesMillisAsync` API
116
function utimesMillis (path, atime, mtime, callback) {
@@ -22,19 +17,19 @@ function utimesMillis (path, atime, mtime, callback) {
2217

2318
async function utimesMillisAsync (path, atime, mtime) {
2419
// if (!HAS_MILLIS_RES) return fs.utimes(path, atime, mtime, callback)
25-
const fd = await open(path, 'r+')
20+
const fd = await fs.open(path, 'r+')
2621

2722
let futimesErr = null
2823
try {
29-
await futimes(fd, atime, mtime)
24+
await fs.futimes(fd, atime, mtime)
3025
} catch (e) {
3126
futimesErr = e
3227
}
3328

3429
let closeErr = null
3530

3631
try {
37-
await close(fd)
32+
await fs.close(fd)
3833
} catch (e) {
3934
closeErr = e
4035
}

0 commit comments

Comments
 (0)