* Returns whether the given file path points to a valid lease.
(file: string)
| 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. |
no test coverage detected