()
| 10 | const debug = Debug('prisma:fetch-engine:cache-dir') |
| 11 | |
| 12 | export async function getRootCacheDir(): Promise<string | null> { |
| 13 | if (os.platform() === 'win32') { |
| 14 | const cacheDir = findCacheDir({ name: 'prisma', create: true }) |
| 15 | if (cacheDir) { |
| 16 | return cacheDir |
| 17 | } |
| 18 | if (process.env.APPDATA) { |
| 19 | return path.join(process.env.APPDATA, 'Prisma') |
| 20 | } |
| 21 | } |
| 22 | // if this is lambda, nope |
| 23 | if (process.env.AWS_LAMBDA_FUNCTION_VERSION) { |
| 24 | try { |
| 25 | await ensureDir(`/tmp/prisma-download`) |
| 26 | return `/tmp/prisma-download` |
| 27 | } catch (e) { |
| 28 | return null |
| 29 | } |
| 30 | } |
| 31 | return process.env.XDG_CACHE_HOME |
| 32 | ? path.join(process.env.XDG_CACHE_HOME, 'prisma') |
| 33 | : path.join(os.homedir(), '.cache/prisma') |
| 34 | } |
| 35 | |
| 36 | export async function getCacheDir(channel: string, version: string, binaryTarget: string): Promise<string | null> { |
| 37 | const rootCacheDir = await getRootCacheDir() |
no outgoing calls
no test coverage detected