test02/node_modules/stdin-discarder
罗佳鸿 6aa1ebe342
Some checks are pending
部署文档 / deploy-gh-pages (push) Waiting to run
first commit
2024-08-13 10:11:19 +08:00
..
index.d.ts first commit 2024-08-13 10:11:19 +08:00
index.js first commit 2024-08-13 10:11:19 +08:00
license first commit 2024-08-13 10:11:19 +08:00
package.json first commit 2024-08-13 10:11:19 +08:00
readme.md first commit 2024-08-13 10:11:19 +08:00

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