import { utimes } from "https://deno.land/x/ayonli_jsext@v0.9.72/fs.ts";
Changes the access (atime
) and modification (mtime
) times of the file
or directory. Given times are either in seconds (UNIX epoch time) or as Date
objects.
NOTE: This function only works in Node.js, Deno and Bun, in other environments, it's a no-op.
Examples
Example 1
Example 1
import { utimes } from "@ayonli/jsext/fs";
// Set the access and modification times to the current time.
await utimes("/path/to/file.txt", Date.now(), Date.now());