Project Name | Stars | Downloads | Repos Using This | Packages Using This | Most Recent Commit | Total Releases | Latest Release | Open Issues | License | Language |
---|---|---|---|---|---|---|---|---|---|---|
Papaparse | 11,611 | 1,982 | 1,291 | 4 days ago | 41 | March 23, 2023 | 176 | mit | JavaScript | |
Fast and powerful CSV (delimited text) parser that gracefully handles large files and malformed input | ||||||||||
Fast Csv | 1,436 | 1,948 | 617 | a day ago | 71 | December 04, 2020 | 66 | mit | TypeScript | |
CSV parser and formatter for node | ||||||||||
Filehelpers | 1,030 | a year ago | 117 | mit | C# | |||||
The FileHelpers are a free and easy to use .NET library to read/write data from fixed length or delimited records in files, strings or streams | ||||||||||
Csv | 462 | 200 | 43 | 3 days ago | 37 | September 17, 2022 | 2 | mit | Elixir | |
CSV Decoding and Encoding for Elixir | ||||||||||
React Papaparse | 311 | 2 | 7 | 3 months ago | 50 | August 13, 2022 | 49 | mit | TypeScript | |
react-papaparse is the fastest in-browser CSV (or delimited text) parser for React. It is full of useful features such as CSVReader, CSVDownloader, readString, jsonToCSV, readRemoteFile, ... etc. | ||||||||||
Tabulator Py | 208 | 52 | 21 | 2 years ago | 141 | March 21, 2021 | 1 | mit | Python | |
Python library for reading and writing tabular data via streams. | ||||||||||
Csv Write Stream | 188 | 442 | 139 | 3 years ago | 12 | April 28, 2016 | 12 | bsd-2-clause | JavaScript | |
A CSV encoder stream that produces properly escaped CSVs | ||||||||||
Csvbuilder | 129 | 12 | 5 | 5 years ago | 6 | August 23, 2018 | 2 | mit | JavaScript | |
Easily encode complex JSON objects to CSV with CsvBuilder's schema-like API | ||||||||||
Excel Stream | 129 | 17 | 10 | 5 years ago | 12 | July 21, 2015 | 10 | mit | JavaScript | |
Csv | 128 | 2 | 2 | a month ago | 2 | July 07, 2022 | 2 | mit | C# | |
Fast C# CSV parser |
Easily encode complex JSON objects to CSV with CsvBuilder's schema-like API.
const CsvBuilder = require('csv-builder')
const data = [
{
name: 'Foo Bar',
meta: {
active: true,
roles: [
'user',
'admin'
]
}
}
]
const builder = new CsvBuilder({
headers: ['Firstname', 'Lastname', 'Role 1', 'Role 2', 'Active'],
alias: {
'Role 1': 'meta.roles[0]',
'Role 2': 'meta.roles[1]',
'Active': 'meta.active'
}
})
.virtual('Firstname', user => user.name.split(' ')[0])
.virtual('Lastname', user => user.name.split(' ')[1])
/* Each of the following produces the following CSV contents:
"Firstname","Lastname","Role 1","Role 2","Active"
"Foo","Bar","user","admin","true"
*/
// (1) Create from a Stream of objects (like a database)
getObjectStream()
.pipe(builder.createTransformStream())
.pipe(fs.createWriteStream('output.csv'))
// (2) Create from an existing payload (`data` is an array of objects)
builder.createReadStream(data)
.pipe(fs.createWriteStream('output.csv'))
// (3) Roll your own
let csv = ''
csv += builder.getHeaders()
data.forEach(item => {
csv += builder.getRow(item)
})
fs.writeFileSync('output.csv', csv)
$ npm i -s csv-builder
# or
$ yarn add csv-builder
getHeaders()
and getRow(object)
methods respectively.headers
String|Arraydelimiter
String The column delimiter. Default ','
terminator
String The row terminator. Default '\n'
quoted
Boolean Quote columns? Default true
alias
Object An object in the format of { "csv header": "object prop" }, object prop
will be aliased to csv header
. Default {}
createReadStream
(payload): Stream.Readable
Creates a readable stream and consumes the payload.
payload
Array<Object> Incoming data.createTransformStream
(): Stream.Transform
Creates a transform stream. The stream expects either Objects or JSON.
headers
(headers): this
headers
String|Array Space separated headers, or array of headersalias
(header, prop): this
Set single or multiple contraints. If header
is an object, it will extend any existing constraints, not replace.
header
String|Object Either object {"header": "property"} Or a string "Header"prop
String|undefined Property to correspond to header, omit if using object.virtual
(prop, fn): this
Create a virtual property. Virtual properties are treated the same as normal properties. If there is no corresponding header or alias, the virtual will not be present in resulting CSV.
prop
String Virtual property namefn
(item: any) => any Where item
is an element from the incoming data, and the return value is the corresponding value for the virtualized property.getHeaders
(): String
The headers in CSV format
getRow
(item): String
Returns the CSV formated row for a given item
.
item
Object A n item matching the "schema".constraints
attribute in options (for constructor) is deprecated, use alias
instead.set(prop, value)
method is deprecated, use alias(prop, value)
instead.