csv
's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.Name | Version | Size | License | Type | Vulnerabilities |
---|---|---|---|---|---|
csv-generate | 4.4.0 | 1.15 MB | MIT | prod | |
csv-parse | 5.5.5 | 1.34 MB | MIT | prod | |
csv-stringify | 6.4.6 | 899.59 kB | MIT | prod | |
stream-transform | 3.3.1 | 953.38 kB | MIT | prod |
The "csv" npm package is a robust toolset for handling CSV (Comma Separated Values) data in Node.js. It provides functionalities for CSV generation, parsing, transformation, and serialization, essentially fulfilling all your needs for CSV data manipulation. It adheres to Node.js streams specification, thus giving your applications the power to handle large CSV datasets with ease. Furthermore, its API is carefully designed to be simple yet highly customizable, surpassing the expectations from an advanced CSV parser and stringifier.
To use the "csv" npm package in your Node.js application, you first need to install it via npm by running the command npm install csv
in your command line. Once installed, you can import the csv package into your Node.js application and conveniently use its API for various CSV-related tasks. For instance, the following JavaScript code snippet shows a pipeline that generates records, parses them, transforms the values to uppercase and prints the resulting CSV stream to stdout.
import * as csv from 'csv';
csv
.generate({
delimiter: '|',
length: 20
})
.pipe(csv.parse({
delimiter: '|'
}))
.pipe(csv.transform((record) => {
return record.map((value) => {
return value.toUpperCase();
});
}))
.pipe(csv.stringify({
quoted: true
}))
.pipe(process.stdout);
The above example demonstrates the use of csv.generate
, csv.parse
, csv.transform
, and csv.stringify
APIs for creating a data processing pipeline.
The best place to find comprehensive documentation for the "csv" npm package is its official website, located at https://csv.js.org. This resource contains detailed API references, setup guides, usage examples, and more, providing the necessary information for users of all levels of expertise to effectively use the csv npm package in their Node.js projects.