@kszongic/split-file-cli
v1.0.0
Published
Split files into chunks by line count or number of parts
Maintainers
Readme
@kszongic/split-file-cli
Split files into chunks by line count, number of parts, or byte size. Zero dependencies.
Install
npm install -g @kszongic/split-file-cliUsage
# Split into chunks of 1000 lines each
split-file data.csv -l 1000
# Split into exactly 5 parts
split-file biglog.txt -n 5
# Split into 10MB chunks
split-file dump.sql -b 10M
# Output to a specific directory with custom prefix
split-file data.csv -l 500 -o chunks/ -p output
# Read from stdin
cat data.txt | split-file - -l 500Options
| Option | Description |
|---|---|
| -l, --lines <n> | Lines per chunk |
| -n, --parts <n> | Number of output parts |
| -b, --bytes <n> | Bytes per chunk (supports K, M, G suffixes) |
| -o, --output <dir> | Output directory (default: .) |
| -p, --prefix <str> | Output filename prefix |
| --ext <ext> | Output file extension |
| -h, --help | Show help |
| -v, --version | Show version |
Output
Files are named {prefix}_{NNN}{ext}:
data_001.csv
data_002.csv
data_003.csvLicense
MIT
