Skip to content

Latest commit

 

History

History
20 lines (14 loc) · 553 Bytes

readline-interface-2.md

File metadata and controls

20 lines (14 loc) · 553 Bytes

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.