https://github.com/kessler/node-csv-splitter
https://github.com/kessler/node-csv-splitter
Last synced: about 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/kessler/node-csv-splitter
- Owner: kessler
- License: apache-2.0
- Created: 2023-08-03T23:00:11.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-08-03T23:28:07.000Z (over 1 year ago)
- Last Synced: 2025-03-08T08:12:40.365Z (about 2 months ago)
- Language: JavaScript
- Size: 21.5 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# @kessler/csv-splitter
A tool for splitting csv files.
Can be used from command line or programmatically.
Each page will end with two newlines. For a csv with headers, each page will begin with the headers.
## cli install
```
npm i -g @kessler/csv-splitter
```## cli usage
### csv with headers
split 4 rows into pages of 2 rows
```
$ echo id,name\n1,foo\n2,bar\n3,blip\n4,blamp | node index.mjs -s 2
id,name
1,foo
2,barid,name
3,blip
4,blamp
```
### csv without headerssplit 4 rows into pages of 2 rows
```
$ echo 1,foo\n2,bar\n3,blip\n4,blamp | node index.mjs -s 2 --noHeaders
1,foo
2,bar3,blip
4,blamp⏎
```## module install
```
npm i @kessler/csv-splitter
```## module usage
```js
import csvSplit from '@kessler/csv-splitter'async function main() {
await csvSplit(process.stdin, process.stdout, { size: 100 })
}main()
```