Created
October 17, 2017 13:15
-
-
Save johndstein/f02cb8720ed2c57fc500f9905bb48f35 to your computer and use it in GitHub Desktop.
Add fixed value column to CSV file
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env node | |
'use strict'; | |
const path = require('path'); | |
if (process.argv.length < 4) { | |
console.error(` | |
Usage: ${path.basename(process.argv[1])} HEADER VALUE | |
We read from STDIN and write to STDOUT. | |
`); | |
process.exit(1); | |
} | |
require('csv-stream-transform')({ | |
transform(row, cb) { | |
row[process.argv[2]] = process.argv[3]; | |
cb(null, row); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment