MCPcopy Create free account
hub / github.com/Snapchat/Valdi / isValid

Method isValid

valdi/vscode_debugger/src/targets/node/lease-file.ts:40–46  ·  view source on GitHub ↗

* Returns whether the given file path points to a valid lease.

(file: string)

Source from the content-addressed store, hash-verified

38 * Returns whether the given file path points to a valid lease.
39 */
40 public static isValid(file: string) {
41 try {
42 return Number(readFileSync(file, 'utf-8')) > Date.now() - LeaseFile.recencyDeadline;
43 } catch {
44 return false;
45 }
46 }
47
48 /**
49 * Updates the leased file.

Callers 1

checkLeaseFileFunction · 0.45

Calls 3

readFileSyncFunction · 0.85
nowMethod · 0.65
NumberClass · 0.50

Tested by

no test coverage detected