Skip to content

Commit 555d21b

Browse files
committed
doc: improve fs.utimes
1 parent ff07eaa commit 555d21b

1 file changed

Lines changed: 12 additions & 15 deletions

File tree

doc/api/fs.md

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1219,12 +1219,12 @@ changes:
12191219
-->
12201220

12211221
* `fd` {integer}
1222-
* `atime` {integer}
1223-
* `mtime` {integer}
1222+
* `atime` {number|string|Date}
1223+
* `mtime` {number|string|Date}
12241224
* `callback` {Function}
12251225

1226-
Change the file timestamps of a file referenced by the supplied file
1227-
descriptor.
1226+
Change the file system timestamps of the object referenced by the supplied file
1227+
descriptor. See [`fs.utimes()`][].
12281228

12291229
*Note*: This function does not work on AIX versions before 7.1, it will return
12301230
the error `UV_ENOSYS`.
@@ -2211,20 +2211,17 @@ changes:
22112211
-->
22122212

22132213
* `path` {string|Buffer|URL}
2214-
* `atime` {integer}
2215-
* `mtime` {integer}
2214+
* `atime` {number|string|Date}
2215+
* `mtime` {number|string|Date}
22162216
* `callback` {Function}
22172217

2218-
Change file timestamps of the file referenced by the supplied path.
2219-
2220-
*Note*: The arguments `atime` and `mtime` of the following related functions
2221-
follow these rules:
2218+
Change the file system timestamps of the object referenced by `path`.
22222219

2223-
- The value should be a Unix timestamp in seconds. For example, `Date.now()`
2224-
returns milliseconds, so it should be divided by 1000 before passing it in.
2225-
- If the value is a numeric string like `'123456789'`, the value will get
2226-
converted to the corresponding number.
2227-
- If the value is `NaN`, `Infinity` or `-Infinity`, an Error will be thrown.
2220+
The `atime` and `mtime` arguments follow these rules:
2221+
- Values can be either numbers representing Unix epoch time, `Date`s, or a
2222+
numeric string like `'123456789.0'`.
2223+
- If the value can not be converted to a number, or is `NaN`, `Infinity` or
2224+
`-Infinity`, a `Error` will be thrown.
22282225

22292226
## fs.utimesSync(path, atime, mtime)
22302227
<!-- YAML

0 commit comments

Comments
 (0)