aboutsummaryrefslogtreecommitdiff
path: root/lib/utils.js
diff options
context:
space:
mode:
authorRuben Beltran del Rio <git@r.bdr.sh>2024-03-09 14:17:34 +0100
committerRuben Beltran del Rio <git@r.bdr.sh>2024-03-09 14:17:34 +0100
commit172f4c8807d44ebe38c7f227b7fdc2d6a9dbe323 (patch)
treeb880761cf254fbc668cea0d577d5331a28af67cc /lib/utils.js
parent36a4680d18de012e2e5c732f9db161dafa884344 (diff)
Allow sync up and down
Diffstat (limited to 'lib/utils.js')
-rw-r--r--lib/utils.js34
1 files changed, 0 insertions, 34 deletions
diff --git a/lib/utils.js b/lib/utils.js
deleted file mode 100644
index cee3f47..0000000
--- a/lib/utils.js
+++ /dev/null
@@ -1,34 +0,0 @@
-import { access, constants, mkdir, rm } from 'fs/promises';
-import { kFileNotFoundError } from './constants.js';
-
-// File system utilities
-
-export const rmIfExists = 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 const ensureDirectoryExists = async function ensureDirectoryExists(directory) {
-
- try {
- await access(directory);
- }
- catch (error) {
- if (error.code === kFileNotFoundError) {
- await mkdir(directory, { recursive: true });
- return;
- }
-
- throw error;
- }
-};