nodedb-json
Version:
A lightweight JSON-based database for Node.js with TypeScript support, indexing, and complex query capabilities
18 lines (17 loc) • 598 B
TypeScript
export interface JsonFileStorageOptions {
atomicWrites: boolean;
backupOnWrite: boolean;
createIfNotExists: boolean;
defaultValue: Record<string, any>;
tempPath: string;
backupPath: string;
}
export declare class JsonFileStorage {
private readonly filePath;
private readonly options;
constructor(filePath: string, options: JsonFileStorageOptions);
read(): Record<string, any>;
write(content: string, backupOnWrite?: boolean): void;
readWithBackup(): Record<string, any>;
}
export declare function readJsonFile(filePath: string): Record<string, any>;