Readline interface 2

Part 1

If you want to pipe something into a Node.js file, readline will read everything from stdin and then close after the pipe has finished:

import { createInterface } from 'readline';
import processLine from './processLine';

const rl = createInterface(process.stdin);

rl.on('line', processLine);

Here's an example usage for inserting eslint-ignore-next-line comments based off of the eslint cli output.

View on Github