(filePath: string)
| 1 | import {promises as fs} from 'fs'; |
| 2 | |
| 3 | export function scheduleCleanup(filePath: string) { |
| 4 | const clean = async () => { |
| 5 | try { |
| 6 | await fs.unlink(filePath); |
| 7 | console.log(`Successfully deleted file: ${filePath}`); |
| 8 | } catch (error) { |
| 9 | console.error(`Error deleting file ${filePath}: ${error}`); |
| 10 | } |
| 11 | }; |
| 12 | |
| 13 | // Wait 10 minutes before removing file. |
| 14 | setTimeout(clean, 10 * 60 * 1000); |
| 15 | } |
no outgoing calls
no test coverage detected