source: node_modules/fs-extra/lib/util/utimes.js

main
Last change on this file was d24f17c, checked in by Aleksandar Panovski <apano77@…>, 15 months ago

Initial commit

  • Property mode set to 100644
File size: 615 bytes
Line 
1'use strict'
2
3const fs = require('graceful-fs')
4
5function utimesMillis (path, atime, mtime, callback) {
6 // if (!HAS_MILLIS_RES) return fs.utimes(path, atime, mtime, callback)
7 fs.open(path, 'r+', (err, fd) => {
8 if (err) return callback(err)
9 fs.futimes(fd, atime, mtime, futimesErr => {
10 fs.close(fd, closeErr => {
11 if (callback) callback(futimesErr || closeErr)
12 })
13 })
14 })
15}
16
17function utimesMillisSync (path, atime, mtime) {
18 const fd = fs.openSync(path, 'r+')
19 fs.futimesSync(fd, atime, mtime)
20 return fs.closeSync(fd)
21}
22
23module.exports = {
24 utimesMillis,
25 utimesMillisSync
26}
Note: See TracBrowser for help on using the repository browser.