UNPKG

libretrodb

Version:
39 lines (38 loc) 1.2 kB
/// <reference types="node" /> import { Entry } from './types'; export declare type Options = { bufferToString: boolean; indexHashes: boolean; }; export declare class Libretrodb<T extends Buffer | string> { private path; private metadataOffset; private firstIndexOffset; private count; private file; private entries; private index; private options; static from<Ops extends Partial<Options>>(path: string, options?: Ops): Promise<Libretrodb<Ops extends { bufferToString: false; } ? Buffer : string>>; constructor(path: string, options?: Partial<Options>); load(): Promise<void>; getEntries(): Entry<T>[]; searchHash(hex: string): Entry<T> | undefined; private readMagicNumber; private readMetadataOffset; private readMetadata; private readEntries; private addToIndex; private rmsgpackRead; private readMap; private readArray; /** * Some rdb files are missing the metadata_offset, so * we duck search the position of the map+count+len from the end * of the file. * https://github.com/libretro/libretro-database/issues/1163 */ private searchForMetadataOffset; }