Skip to content

@bight-ts/storage-json

import { JsonStorageAdapter } from "@bight-ts/storage-json";

Implements StorageAdapter using a JSON file on disk.

new JsonStorageAdapter({ filePath: "./data/db.json" });
OptionTypeRequiredDescription
filePathstringYesPath to the JSON file. Created automatically with parent directories.
  • Reads and writes the entire file on every operation (no partial updates).
  • Data structure: { global: Record<string, StorageValue>, guilds: Record<string, Record<string, StorageValue>> }
  • Suitable for local development and small bots. Not recommended for production.