#!/usr/bin/env node
'use strict';
const { promisify } = require('util');
const { createReadStream, createWriteStream, readFile: readFileOrig, writeFile: writeFileOrig } = require('fs');
const os = require('os');
const { isAbsolute, join } = require('path');
const program = require('commander');
const pkg = require('../package');
const json2csv = require('../lib/json2csv');
const parseNdJson = require('./utils/parseNdjson');
const TablePrinter = require('./utils/TablePrinter');
const readFile = promisify(readFileOrig);
const writeFile = promisify(writeFileOrig);
const { unwind, flatten } = json2csv.transforms;
const JSON2CSVParser = json2csv.Parser;
const Json2csvTransform = json2csv.Transform;
program
.version(pkg.version)
.option('-i, --input ', 'Path and name of the incoming json file. Defaults to stdin.')
.option('-o, --output