]> git.r.bdr.sh - rbdr/blog/blobdiff - lib/utils.js
Allow sync up and down
[rbdr/blog] / lib / utils.js
diff --git a/lib/utils.js b/lib/utils.js
deleted file mode 100644 (file)
index 25d204a..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-import { access, constants, mkdir, rm } from 'fs/promises';
-import { kFileNotFoundError } from './constants.js';
-
-// File system utilities
-
-export async function rmIfExists(location) {
-
-  try {
-    await access(location, constants.F_OK);
-    await rm(location, { recursive: true });
-  }
-  catch (error) {
-    if (error.code === kFileNotFoundError) {
-      return;
-    }
-
-    throw error;
-  }
-}
-
-export async function ensureDirectoryExists(directory) {
-
-  try {
-    await access(directory);
-  }
-  catch (error) {
-    if (error.code === kFileNotFoundError) {
-      await mkdir(directory, { recursive: true });
-      return;
-    }
-
-    throw error;
-  }
-}