@alinex/datastore
Version:
Read, work and write data structures from and to differents locations and formats.
64 lines • 2.21 kB
TypeScript
/// <reference types="node" />
import { MergeInput } from "@alinex/data/lib/merge";
import * as compressor from "./compression";
import * as formatter from "./format";
interface Options {
proxy?: string;
httpMethod?: string;
httpHeader?: string[];
httpData?: string;
ignoreError?: boolean;
privateKey?: Buffer | string;
passphrase?: string;
tail?: number;
search?: string;
compression?: compressor.Compression;
compressionLevel?: number;
format?: formatter.Format;
pattern?: RegExp;
records?: boolean;
delimiter?: string;
quote?: string;
module?: boolean;
rootName?: string;
}
interface DataSource extends MergeInput {
source?: string;
options?: Options;
meta?: any;
}
declare class DataStore {
data: any;
options: Options;
private _source;
private _map;
private _load;
private changed;
constructor(...input: DataSource[]);
static load(...input: DataSource[]): Promise<DataStore>;
static url(source: string, options?: Options): Promise<DataStore>;
static data(data: any, source?: string): Promise<DataStore>;
load(...input: DataSource[]): Promise<any>;
private multiload;
reload(time?: number): Promise<boolean>;
save(output?: DataSource): Promise<boolean>;
parse(uri: string, buffer: Buffer | string, options?: Options): Promise<any>;
format(uri: string, options?: Options): Promise<Buffer>;
get source(): DataSource[] | string | undefined;
set source(data: DataSource[] | string | undefined);
get meta(): any;
get map(): any;
has(command?: string): boolean;
get(command?: string, fallback?: any): any;
filter(command?: string, fallback?: any): DataStore;
set(path: string | number, value: any, doNotReplace?: boolean): any;
insert(path: string | number, value: any, pos?: number): void;
push(path: string | number, ...values: any[]): void;
empty(path: string | number): any;
delete(path: string | number): any;
}
declare const formats: string[];
declare const compressions: string[];
export { DataStore, formats, compressions, DataSource, Options };
export default DataStore;
//# sourceMappingURL=index.d.ts.map