()
| 28 | } |
| 29 | |
| 30 | export async function loadToken(): Promise<string | null> { |
| 31 | try { |
| 32 | const data = await fs.readFile(CREDENTIALS_FILE, "utf-8") |
| 33 | const credentials: Credentials = JSON.parse(data) |
| 34 | return credentials.token |
| 35 | } catch (error) { |
| 36 | if ((error as NodeJS.ErrnoException).code === "ENOENT") { |
| 37 | return null |
| 38 | } |
| 39 | throw error |
| 40 | } |
| 41 | } |
| 42 | |
| 43 | export async function loadCredentials(): Promise<Credentials | null> { |
| 44 | try { |
no test coverage detected