feat(cafs): extend cafs with getFilePathByModeInCafs (#5232)

This commit is contained in:
Dominic Elm
2022-08-18 11:32:08 +02:00
committed by GitHub
parent 5b938a91b4
commit 745143e797
3 changed files with 8 additions and 0 deletions

View File

@@ -0,0 +1,6 @@
---
"@pnpm/cafs": minor
"@pnpm/cafs-types": minor
---
Extend cafs with `getFilePathByModeInCafs`.

View File

@@ -57,6 +57,7 @@ export interface Cafs {
addFilesFromDir: (dir: string, manifest?: DeferredManifestPromise) => Promise<FilesIndex>
addFilesFromTarball: (stream: NodeJS.ReadableStream, manifest?: DeferredManifestPromise) => Promise<FilesIndex>
getFilePathInCafs: (integrity: string | IntegrityLike, fileType: FileType) => string
getFilePathByModeInCafs: (integrity: string | IntegrityLike, mode: number) => string
importPackage: ImportPackageFunction
tempDir: () => Promise<string>
}

View File

@@ -41,6 +41,7 @@ export default function createCafs (cafsDir: string, ignore?: ((filename: string
addFilesFromDir: addFilesFromDir.bind(null, { addBuffer, addStream }),
addFilesFromTarball: addFilesFromTarball.bind(null, addStream, ignore ?? null),
getFilePathInCafs: getFilePathInCafs.bind(null, cafsDir),
getFilePathByModeInCafs: getFilePathByModeInCafs.bind(null, cafsDir),
}
}