Easy and fast Node.JS package / cli for CSV to HTML conversion
Features • Installation • Usage • License
- Converts CSV to HTML as Node.JS package or CLI
- Ability to choose the delimiter
- Ability to add title to HTML document
- Converts CSV to HTML fast (± 1s / 200000 lines) - Average on Macbook Pro 2018 w/ i7
# CLI
$ npm i -g @leafgard/csv2html
OR
$ yarn global add @leafgard/csv2html
# Package
$ npm i @leafgard/csv2html
OR
$ yarn add @leafgard/csv2html
Here is a basic CLI usage example:
$ csv2html -i input.csv -o output.html
You can provide options like:
-d
CSV parsing delimiter, f.e:-d ';'
-t
Provides title to HTML document:-t 'My document'
Here is a basic usage example as a Node.JS package:
const { CSVToHTML } = require('@leafgard/csv2html')
const converter = new CSVToHTML()
converter
.setOptions({
delimiter: ';',
documentTitle: 'My document'
}) // (Optional)
.setInputFile('data.csv')
.setOutputFile('output.html')
// You can also turn this into async/await expression
.convert()
.then(() => {
// Do something
}).catch((err) => {
// Catch error
})
This project is licensed under the MIT License - see the LICENSE.md file for details.