
Security News
OWASP 2025 Top 10 Adds Software Supply Chain Failures, Ranked Top Community Concern
OWASP’s 2025 Top 10 introduces Software Supply Chain Failures as a new category, reflecting rising concern over dependency and build system risks.
Node library for mapping CSV files with flexible YAML DSL for the mapping definition.
This library is designed to take input CSV file and map it to output CSV files according to the very flexible YAML/JSON mapping.
npm$ npm install
$ grunt build
To make the application globally available, please do:
sudo npm install csv-mapper -g
Usage: csv-mapper --mapping [mapping.yaml]
Options:
--help, -h Shows usage info and exits.
--inCsv The input product CSV file (optional, STDIN would be used if not specified).
--outCsv The output product CSV file (optional, STDOUT would be used if not specified).
--csvDelimiter CSV delimiter (by default ,).
--inCsvDelimiter CSV delimiter in input file (by default csvDelimiter is used).
--outCsvDelimiter CSV delimiter in output files (by default csvDelimiter is used).
--csvQuote CSV quote (by default ").
--mapping, -m Mapping JSON file or URL. [required]
--group The column group that should be used. [string] [default: "default"]
--additionalOutCsv Addition output CSV files separated by comma `,` and optionally prefixed with `groupName:`.
--timeout Set timeout for requests [default: 300000]
--dryRun, -d No external side-effects would be performed [default: false]
--attemptsOnConflict Number of attempts to update the project in case of conflict (409 HTTP status) [default: 10]
--disableAsserts disable asserts (e.g.: required)
The only required argument is mapping (see below).
Mapping is a YAML/JSON document that has following structure:
{
"description": "Test mapping",
"columnMapping": [{
"type": "addColumn",
"toCol": "constant",
"valueTransformers": [
{"type": "constant", "value": "Foo"}
]
},
...
]
}
There are several concepts, that you need to be aware of, when you are defining the mapping:
In the top-level object of mapping you can specify following properties:
They are used to create/delete columns. You can use column mappings of following types:
Value transformers are used to generate/transform column value.
The output of one transformer in the list would be passed as input to the next one.
If input is undefined, all transformers will ignore it and pass it to the next transformer (so if you want to make sure that column has some non-empty value, please use regexp value transformer).
Here is the list of standard value transformers:
0)0)$1 to insert groups)Here is the list of workflow value transformers:
Then you define column mappings, you can also provide an array of groups. Then when you are performing actual mapping you can provide a set of additional output files. Each additional output file should have the column group name - this will define, which columns this file contains. Here is an example:
csv-mapper --mapping mapping.json --additionalOutCsv a:/path/to/a.csv,b:/path/to/b.csv
in this case /path/to/a.csv, for instance, will contain only columns that have group a.
There are 2 special group names:
You can find example mapping in the project itself. If you are in the project root, you can map an example CSV file like this:
csv-mapper --mapping test-data/test-mapping.json --inCsv test-data/test-large.csv
Tests are written using jasmine (behavior-driven development framework for testing javascript code). Thanks to jasmine-node, this test framework is also available for node.js.
To run tests, simple execute the test task using grunt.
$ grunt test
In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using Grunt. More info here
Releasing a new version is completely automated using the Grunt task grunt release.
grunt release // patch release
grunt release:minor // minor release
grunt release:major // major release
Copyright (c) 2014 Oleg Ilyenko Licensed under the MIT license.
FAQs
Node library for mapping CSV files with flexible YAML DSL for the mapping definition.
We found that csv-mapper demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
OWASP’s 2025 Top 10 introduces Software Supply Chain Failures as a new category, reflecting rising concern over dependency and build system risks.

Research
/Security News
Socket researchers discovered nine malicious NuGet packages that use time-delayed payloads to crash applications and corrupt industrial control systems.

Security News
Socket CTO Ahmad Nassri discusses why supply chain attacks now target developer machines and what AI means for the future of enterprise security.