Skip to content

Commit

Permalink
fix(dirs): mkdir when creating cache to prevent errors
Browse files Browse the repository at this point in the history
  • Loading branch information
uladkasach committed Jan 7, 2024
1 parent 05876f1 commit b3f00fa
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/cache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,10 @@ export const createCache = ({
directoryToPersistTo: DirectoryToPersistTo;
defaultSecondsUntilExpiration?: number;
}): SimpleOnDiskCache => {
// kick off creating the directory if it doesn't already exist, to prevent usage errors
if (isMountedDirectory(directoryToPersistTo))
void fs.mkdir(directoryToPersistTo.mounted.path, { recursive: true });

/**
* define how to set an item into the cache
*/
Expand Down

0 comments on commit b3f00fa

Please sign in to comment.