Files
Booster-role/src/db/sqlitePath.ts
T

13 lines
317 B
TypeScript
Raw Normal View History

import { mkdirSync } from "node:fs";
import { dirname } from "node:path";
export function prepareSqlitePath(databaseUrl: string): string {
const sqlitePath = databaseUrl.replace(/^file:/, "");
if (sqlitePath !== ":memory:") {
mkdirSync(dirname(sqlitePath), { recursive: true });
}
return sqlitePath;
}