You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
18 lines
432 B
18 lines
432 B
#!/usr/bin/env node
|
|
|
|
import {readFile} from 'node:fs/promises';
|
|
import { gronReadStream } from './ngronstream.mjs';
|
|
|
|
const main = async (args) => {
|
|
if (args.length === 0) {
|
|
process.stderr.write(`Usage: ngron [filename]\n`);
|
|
process.exit(1);
|
|
}
|
|
const content = await readFile(args[0], {encoding: 'utf8'});
|
|
const json = JSON.parse(content);
|
|
gronReadStream(json).pipe(process.stdout);
|
|
|
|
}
|
|
|
|
main(process.argv.slice(2));
|