1. stdin-discarder
Discard stdin input except for Ctrl+C
stdin-discarder
Package: stdin-discarder
Created by: sindresorhus
Last modified: Sat, 06 Jan 2024 09:21:37 GMT
Version: 0.2.2
License: MIT
Downloads: 6,560,186
Repository: https://github.com/sindresorhus/stdin-discarder

Install

npm install stdin-discarder
yarn add stdin-discarder

stdin-discarder

Discard stdin input except for Ctrl+C

This can be useful to prevent stdin input from interfering with stdout output. For example, you are showing a spinner, and if the user presses a key, it would interfere with the spinner, causing visual glitches. This package prevents such problems.

This has no effect on Windows as there is no good way to implement discarding stdin properly there.

This package is used by ora for its discardStdin option.

Install

 npm install stdin-discarder

Usage

 import stdinDiscarder from 'stdin-discarder';

stdinDiscarder.start();

API

stdinDiscarder.start()

Start discarding stdin.

stdinDiscarder.stop()

Stop discarding stdin.

  • hook-std - Hook and modify stdout and stderr

RELATED POST

10 Must-Know Windows Shortcuts That Will Save You Time

10 Must-Know Windows Shortcuts That Will Save You Time

Arrays vs Linked Lists: Which is Better for Memory Management in Data Structures?

Arrays vs Linked Lists: Which is Better for Memory Management in Data Structures?

Navigating AWS Networking: Essential Hacks for Smooth Operation

Navigating AWS Networking: Essential Hacks for Smooth Operation

Achieving Stunning Visuals with Unity's Global Illumination

Achieving Stunning Visuals with Unity's Global Illumination

Nim's Hidden Gems: Lesser-known Features for Writing Efficient Code

Nim's Hidden Gems: Lesser-known Features for Writing Efficient Code