@xcrap/parser
Version:
Xcrap Parser is a package of the Xcrap framework, it was developed to take care of the data extraction part of text files (currently supporting only HTML and JSON) using declarative models.
14 lines (13 loc) • 536 B
TypeScript
import { Abortable } from "node:events";
import { OpenMode } from "node:fs";
import { ParsingModel } from "./parsing-model-interface";
export type ParserLoadFileOptions = ({
encoding?: BufferEncoding | null;
flag?: OpenMode;
} & Abortable) | null;
export declare class Parser {
readonly source: string;
constructor(source: string);
parseModel(parsingModel: ParsingModel): Promise<any>;
static loadFile<T extends typeof Parser>(this: T, path: string, options?: ParserLoadFileOptions): Promise<InstanceType<T>>;
}