Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/leobalter/csv-table
Prints a table out from a pointed CSV file.
https://github.com/leobalter/csv-table
Last synced: about 2 months ago
JSON representation
Prints a table out from a pointed CSV file.
- Host: GitHub
- URL: https://github.com/leobalter/csv-table
- Owner: leobalter
- License: other
- Created: 2014-07-29T07:12:58.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2014-07-29T08:30:22.000Z (over 10 years ago)
- Last Synced: 2024-11-19T02:57:40.760Z (about 2 months ago)
- Language: JavaScript
- Size: 212 KB
- Stars: 4
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# CSV-Table
[![Build Status](https://travis-ci.org/leobalter/csv-table.svg?branch=master)](https://travis-ci.org/leobalter/csv-table)
## Install
```dash
$ npm install -g csv-table
```## CLI
```dash
$ csv-table [options]
```### Options
```
-h, --help output usage information
-V, --version output the version number
-d, --delimiter Sets the delimiter, defaults to ';'
-c, --columns Use CSV columns headers
-t, --trim trim values
-l, --ltrim left trim values
-r, --rtrim right trim values
-s, --skip skip empty lines
-q, --quote Quote character, defaults to '"'
-m, --comment Comment character, default is none
-e, --escape Escape character, default is '"'
-r, --rowDelimiter Row delimiter character, default is '\n'
```## API
```js
var csvTable = require( "csv-table" );csvTable( csv_file [, options] [, callback] );
// Example:
csvTable( "./data.csv", { columns: true }, function( table, obj ) {
// table is the string representation of the table
console.log( table );// obj is the object representation of the tablified csv
console.log( obj );
});
```If no callback is given, it prints the table to the console/stdout.
### Options:
With default values:
```js
{
delimiter: ';',
columns: false,
trim: false,
ltrim: false,
rtrim: false,
skip_empty_values: false,
quote: '"'
comment: '',
escape: '"',
rowDelimiter: '\n'
}
```## Contributing:
Check out the [contributing](https://github.com/leobalter/csv-table/blob/master/CONTRIBUTING.md) file