blob: 92714f36dfe5e39e13c3a004b795bc8e2b9934c5 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
import { LockSet } from '$lib/vendor/lock';
import fs from 'node:fs/promises';
import process from 'node:process';
import path from 'node:path';
const lockSet = new LockSet();
const baseDataPath =
process.env.BASE_DATA_PATH ?? path.join(process.cwd(), 'data');
const usersDir = path.join(baseDataPath, 'users');
const disksDir = path.join(baseDataPath, 'disks');
export const userExists = async (username: string) => {
const unlock = await lockSet.get(username).acquireRead();
try {
fs.open(path.join(baseDataPath, ''));
} catch (error) {
unlock();
throw error;
}
};
|