MCPcopy
hub / github.com/prisma/prisma / getRootCacheDir

Function getRootCacheDir

packages/fetch-engine/src/utils.ts:12–34  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

10const debug = Debug('prisma:fetch-engine:cache-dir')
11
12export 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
36export async function getCacheDir(channel: string, version: string, binaryTarget: string): Promise<string | null> {
37 const rootCacheDir = await getRootCacheDir()

Callers 3

parseMethod · 0.90
cleanupCacheFunction · 0.90
getCacheDirFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected