Skip to content
This repository was archived by the owner on Jul 15, 2021. It is now read-only.

Commit d70204b

Browse files
committed
Add CHANGELOG.md entry for streaming. Refs #27
1 parent 7e9f8ef commit d70204b

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

CHANGELOG.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,30 @@ All notable changes to this project will be documented in this file.
4545
});
4646
```
4747

48+
- To pipe the output into a file that contains a single valid JSON structure, the output of the parser steam transform needs to be wrapped in statement list node where every statement is separated by a comma.
49+
50+
``` javascript
51+
var fs = require('fs');
52+
var sqliteParser = require('sqlite-parser');
53+
var parserTransform = sqliteParser.createParser();
54+
var singleNodeTransform = sqliteParser.createStitcher();
55+
var readStream = fs.createReadStream('./large-input-file.sql');
56+
var writeStream = fs.createWriteStream('./large-output-file.json');
57+
58+
readStream.pipe(parserTransform);
59+
parserTransform.pipe(singleNodeTransform);
60+
singleNodeTransform.pipe(writeStream);
61+
62+
parserTransform.on('error', function (err) {
63+
console.error(err);
64+
process.exit(1);
65+
});
66+
67+
writeStream.on('finish', function () {
68+
process.exit(0);
69+
});
70+
```
71+
4872
- Added missing `ATTACH DATABASE` statement. It will pair nicely with the existing `DETACH DATABASE` statement.
4973

5074
``` sql

0 commit comments

Comments
 (0)