UNPKG

sql-to-json-converter

Version:

Powerful SQL to JSON converter with support for large files and multiple output formats. Converts SQL database dumps to structured JSON files.

70 lines 2.16 kB
#!/usr/bin/env node import { ConverterOptions, ConversionResult, SeparateFilesResult } from './types'; /** * SQL to JSON Converter class with full TypeScript support */ export declare class SQLToJSONConverter { private readonly batchSize; private readonly showMemory; private readonly limit; private readonly skipUnparsable; private readonly outputMode; private readonly outputDir; private processedStatements; private readonly tables; private currentTable; private insideTransaction; constructor(options?: ConverterOptions); /** * Log current memory usage if enabled */ private logMemoryUsage; /** * Parse CREATE TABLE statement */ private parseCreateTable; /** * Parse INSERT INTO statement */ private parseInsertInto; /** * Parse individual values from VALUES clause */ private parseValues; /** * Clean and convert SQL values to proper JavaScript types */ private cleanValue; /** * Process a single SQL statement */ private processStatement; /** * Process large SQL files with streaming */ processLargeSQL(inputFile: string, outputFile?: string): Promise<void>; /** * Ensure output directory exists */ private ensureOutputDirectory; /** * Write separate JSON files for each table */ private writeSeparateJSONFiles; /** * Write combined JSON file */ private writeCombinedJSON; /** * Convert SQL content to JSON (in-memory processing) */ sqlToJson(content: string): ConversionResult; /** * Convert SQL content to separate JSON files */ sqlToJsonFiles(content: string, outputDir?: string): SeparateFilesResult; } export declare const sqlToJson: (content: string, options?: ConverterOptions) => ConversionResult; export declare const sqlToJsonFiles: (content: string, outputDir?: string, options?: ConverterOptions) => SeparateFilesResult; export declare const processLargeSQL: (inputFile: string, outputFile?: string, options?: ConverterOptions) => Promise<void>; //# sourceMappingURL=cli.d.ts.map