File tree Expand file tree Collapse file tree 2 files changed +4
-3
lines changed Expand file tree Collapse file tree 2 files changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -212,10 +212,11 @@ const Json2csvTransform = require('json2csv').Transform;
212
212
213
213
const fields = [' field1' , ' field2' , ' field3' ];
214
214
const opts = { fields };
215
+ const transformOpts = { highWaterMark: 16384 , encoding: ' utf-8' };
215
216
216
217
const input = fs .createReadStream (inputPath, { encoding: ' utf8' });
217
218
const output = fs .createWriteStream (outputPath, { encoding: ' utf8' });
218
- const json2csv = new Json2csvTransform (opts);
219
+ const json2csv = new Json2csvTransform (opts, transformOpts );
219
220
220
221
const processor = input .pipe (json2csv).pipe (output);
221
222
Original file line number Diff line number Diff line change @@ -5,8 +5,8 @@ const Parser = require('jsonparse');
5
5
const JSON2CSVBase = require ( './JSON2CSVBase' ) ;
6
6
7
7
class JSON2CSVTransform extends Transform {
8
- constructor ( opts ) {
9
- super ( opts ) ;
8
+ constructor ( opts , transformOpts ) {
9
+ super ( transformOpts ) ;
10
10
11
11
// Inherit methods from JSON2CSVBase since extends doesn't
12
12
// allow multiple inheritance and manually preprocess opts
You can’t perform that action at this time.
0 commit comments