@aurios/jason
Version:
A simple, lightweight, and embeddable JSON document database built on Bun.
22 lines (21 loc) • 773 B
TypeScript
export default class Metadata {
#private;
constructor(path: string);
get documentCount(): number;
get indexes(): string[];
incrementDocumentCount(amount?: number): Promise<void>;
decrementDocumentCount(amount?: number): Promise<void>;
addIndex(indexName: string): Promise<void>;
updateLastModified(): Promise<void>;
/**
* Loads the collection metadata from the file system.
*
* Reads the metadata file and parses its JSON content to update the
* metadata property. If the file cannot be read or does not exist,
* it initializes the metadata by saving the default metadata to
* the file system.
*
* @returns A promise that resolves when the metadata is loaded.
*/
load(): Promise<void>;
}