Skip to Content
APIutimes

utimes

Set the access and modification times of a file (atime, mtime). Accepts numbers (seconds since epoch) or Date-like values per Node.js.

Basic usage

import { utimes } from '@rush-fs/core' await utimes('./file.txt', atime, mtime)

Methods

utimes(path, atime, mtime)

Async. Returns Promise<void>.

ArgumentTypeDescription
pathstringFile path.
atimenumberAccess time (e.g. seconds since epoch).
mtimenumberModification time.

utimesSync(path, atime, mtime)

Sync. Same arguments; throws on error.

Performance

Single syscall; on par with Node.js. See Benchmarks.

Notes

  • Precision: Platform-dependent; same as Node.js.
Last updated on