Skip to content

Path.unlinkSync() method

pathlib-ts > Path > unlinkSync

Remove the file or link synchronously.

Signature:

unlinkSync(options?: {
missingOk?: boolean;
}): void;

Parameter

Type

Description

options

{ missingOk?: boolean; }

(Optional) Deletion behaviour flags (missingOk).

Returns:

void

Mirrors Path.unlink() but executes synchronously.

Cleaning up generated files synchronously

import { Path } from "pathlib-ts";
const artifact = new Path("./dist/app.js");
artifact.unlinkSync({ missingOk: true });