UNPKG

1.07 kBPlain TextView Raw
1#!/usr/bin/env node
2
3import * as yargs from 'yargs'
4import { runScript } from '../script'
5import { ndjsonMap } from '../stream/ndjson/ndjsonMap'
6
7runScript(async () => {
8 const {
9 in: inputFilePath,
10 out: outputFilePath,
11 mapper: mapperFilePath,
12 logEveryInput,
13 logEveryOutput,
14 limitInput,
15 limitOutput,
16 } = yargs.options({
17 in: {
18 type: 'string',
19 demandOption: true,
20 desc: 'Input ndjson file path',
21 },
22 out: {
23 type: 'string',
24 desc: 'Output ndjson file path',
25 demandOption: true,
26 },
27 mapper: {
28 type: 'string',
29 desc: 'Mapper file path',
30 demandOption: true,
31 },
32 logEveryInput: {
33 type: 'number',
34 default: 1000,
35 },
36 logEveryOutput: {
37 type: 'number',
38 default: 100_000,
39 },
40 limitInput: {
41 type: 'number',
42 },
43 limitOutput: {
44 type: 'number',
45 },
46 }).argv
47
48 await ndjsonMap({
49 inputFilePath,
50 outputFilePath,
51 mapperFilePath,
52 logEveryInput,
53 logEveryOutput,
54 limitInput,
55 limitOutput,
56 })
57})