Skip to content

Commit

Permalink
create CacheDir if it doesnt exist
Browse files Browse the repository at this point in the history
  • Loading branch information
dev2-nomo committed Nov 22, 2023
1 parent b57a364 commit 31c0108
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/util/extract-tar-gz.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { logFatal } from "../util/util";
import * as tar from "tar";
import { resolve, join } from "path";
import { existsSync } from "fs";
import { existsSync, mkdirSync } from "fs";

const requiredFiles = ["index.html", "nomo_icon.svg", "nomo_manifest.json"];
const cacheDirectory = "./cache";
Expand All @@ -12,6 +12,11 @@ export async function extractAndCache(args: {
}) {
const { tarFilePath, destinationDir = cacheDirectory } = args;

if (!existsSync(destinationDir)) {
console.log(`Creating cache directory: ${destinationDir}`);
mkdirSync(destinationDir);
}

try {
await tar.x({
file: tarFilePath,
Expand Down

0 comments on commit 31c0108

Please sign in to comment.