UNPKG

hnswsqlite

Version:

Vector search with HNSWlib and SQLite in TypeScript.

20 lines (19 loc) 770 B
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.initDatabase = initDatabase; const vectorStore_1 = require("../../vectorStore"); const fs_1 = require("fs"); const path_1 = __importDefault(require("path")); function initDatabase(dbPath, dim) { // Create directory if it doesn't exist const dir = path_1.default.dirname(dbPath); if (dir && !(0, fs_1.existsSync)(dir)) { (0, fs_1.mkdirSync)(dir, { recursive: true }); } // Initialize the store which will create the database and tables const store = new vectorStore_1.VectorStore(dbPath, dim); store.close(); }