Skip to content

Path.touchSync() method

pathlib-ts > Path > touchSync

Create the file or update its timestamps synchronously.

Signature:

touchSync(options?: {
mode?: number;
existOk?: boolean;
}): void;

Parameter

Type

Description

options

{ mode?: number; existOk?: boolean; }

(Optional) File creation behaviour flags (mode, existOk).

Returns:

void

Mirrors Path.touch() but executes synchronously.

Creating a sentinel file synchronously

import { Path } from "pathlib-ts";
const sentinel = new Path("./tmp/.ready");
sentinel.touchSync({ existOk: true });