You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jul 15, 2021. It is now read-only.
To allow users to parse arbitrarily long SQL files or other readable stream sources, I want to create a stream transform that can accept a readable stream and then push (write) out JSON strings of the ASTs for individual statements, e.g.:
import{createReadStream}from'fs';import{SqliteParserTransform}from'sqlite-parser';constparser=newSqliteParserTransform();// A file with hundreds of SQL queriesconstfileName='./test/sql/official-suite/randexpr1-1.sql';constread=createReadStream(fileName);// Pipe the readable stream to the parser transformread.pipe(parser);// Stream the ASTs for individual statements to stdoutparser.pipe(process.stdout);parser.on('error',function(err){console.log(err);process.exit(1);});parser.on('finish',function(){process.exit(0);});