node-json-db
Version:
Database using JSON file as storage for Node.JS
21 lines (20 loc) • 440 B
TypeScript
/**
* Use to read and write data of type T
*/
export interface IAdapter<T> {
/**
* Read the data from the medium
*/
readAsync: () => Promise<T | null>;
/**
* Write date into the medium
* @param data
*/
writeAsync: (data: T) => Promise<void>;
}
export interface IFileAdapter<T> extends IAdapter<T> {
/**
* Name of the file used by the file adapter
*/
readonly filename: string;
}