providing password reset services for a long while: circa 2025

feat: auto make data dir

+9
+9
features/message-queue.ts
··· 1 1 import { Database } from "bun:sqlite"; 2 + import { mkdir } from "node:fs/promises"; 2 3 import type { Block, SlackAPIClient } from "slack-edge"; 3 4 4 5 export interface SlackMessage { ··· 23 24 24 25 constructor(slackClient: SlackAPIClient, dbPath = "slack-queue.db") { 25 26 this.slack = slackClient; 27 + const dir = dbPath.split("/").slice(0, -1).join("/"); 28 + if (dir) { 29 + try { 30 + mkdir(dir); 31 + } catch (e) { 32 + // Directory may already exist 33 + } 34 + } 26 35 this.db = new Database(dbPath); 27 36 this.initDatabase(); 28 37 this.processQueue();