csv-merger
TypeScript icon, indicating that this package has built-in type declarations

0.1.4 • Public • Published

csv-merger

Merge multiple CSV files into one

Installation

To install locally:

npm install csv-merger

To install globally:

npm install -g csv-merger

Standalone Use Case

To use as a standalone application, install globally. To get help

csv-merger -h

To merge multiple csv files into a single csv:

csv-merger -o output.csv input1.csv input2.csv input3.csv ...

If output filename is not provided via -o option, output filename will be set to merged.csv by default.

Local Use Case

To use locally, install the package in the local directory. Then, the package can be imported as:

const csvMerger = require('csv-merger');

The package includes merge function with the following arguments:

csvMerger.merge(inputFiles, options);

inputFiles is a string array containing the path to input CSV files. options object is optional and has the following format:

options = {
    outputPath, // string: path to the output CSV file
    writeOutput, // boolean: if true, the output will be written to a file, otherwise will be returned by the function
}

The merge function returns a promise. If the writeOutput option is true, the function returns a boolean promise, which is true if file is successfully written, and false otherwise. If writeOutput is set to false (default value), the merge function returns a string promise containing the CSV output.

Readme

Keywords

none

Package Sidebar

Install

npm i csv-merger

Weekly Downloads

333

Version

0.1.4

License

MIT

Unpacked Size

107 MB

Total Files

22

Last publish

Collaborators

  • kamali