Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/ayonli_jsext/fs.ts>utimes

A JavaScript extension package for building strong and modern applications.
Latest
function utimes
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

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());

Parameters

path: string
atime: number | Date
mtime: number | Date

Returns

Promise<void>