setTime
Updates access and modification timestamps.
Example
ts
import { D } from "@duplojs/utils";
import { SF } from "@duplojs/server-utils";
const now = D.now();
const result = await SF.setTime("/tmp/file.txt", {
accessTime: now,
modifiedTime: now,
});
// result: E.Ok | SF.FileSystemLeft
await SF.setTime("/tmp/report.txt", {
accessTime: now,
modifiedTime: now,
});Syntax
typescript
function setTime(
path: string | URL,
params: {
accessTime: D.TheDate;
modifiedTime: D.TheDate;
}
): Promise<FileSystemLeft | E.Ok>Parameters
path: target path.params.accessTime: access time.params.modifiedTime: date de modification.
Return value
E.Ok: if the operation succeeds.FileSystemLeft: if the operation fails.
Notes
D.TheDateis the date type provided by@duplojs/utils.
See also
setMode- Sets permissions for a file or directory.
