Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions types/cacache/cacache-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ cacache.get.stream.byDigest(cachePath, "sha512-SoMeDIGest+64==").pipe(fs.createW

cacache.get.info(cachePath, "my-thing").then(() => {});

cacache.get.info(cachePath, "my-thing", { memoize: true }).then(() => {});

cacache.get.info(cachePath, "my-thing", { memoize: new Map() }).then(() => {});

cacache.get.hasContent(cachePath, "sha521-NOT+IN/CACHE==").then((res) => {
res; // $ExpectType HasContentObject | false
});
Expand Down
4 changes: 3 additions & 1 deletion types/cacache/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ export namespace get {
size?: number | undefined;
}

type InfoOptions = Pick<Options, "memoize">;

interface GetStreamEvents extends Minipass.Events<Buffer> {
// eslint-disable-next-line @definitelytyped/no-single-element-tuple-type
integrity: [integrity: string];
Expand Down Expand Up @@ -116,7 +118,7 @@ export namespace get {
* Looks up `key` in the cache index, returning information about the entry
* if one exists.
*/
function info(cachePath: string, key: string): Promise<CacheObject>;
function info(cachePath: string, key: string, opts?: InfoOptions): Promise<CacheObject | null>;

/**
* Returns a Readable Stream of the cached data identified by `key`.
Expand Down