Skip to content

vaultmd / withFileDelete

Function: withFileDelete()

withFileDelete(fullPath, lockKey, relForCommit, opts?): Promise<{ deleted: boolean; }>

Defined in: src/locked-file/delete.ts:19

Delete a vault file inside the per-file lock, emitting a CommitEvent on success. The delete is idempotent: if the file is already absent the promise resolves with { deleted: false } rather than throwing.

Parameters

fullPath

string

Absolute filesystem path to the target file.

lockKey

string

Canonical/case-folded serialization key — pass VaultIo.toKey(rel).

relForCommit

string

Display path written to CommitEvent.path — pass VaultIo.toVaultRelative(rel).

opts?

Optional onCommit callback and cross-process lock config.

cross?

false | CrossLock

Cross-process lock config, or false (default) for in-process only.

onCommit?

(e) => void | Promise<void>

Optional callback invoked after the file is successfully deleted.

Returns

Promise<{ deleted: boolean; }>

{ deleted: true } when the file was removed; { deleted: false } when absent.