Gathering detailed insights and metrics for readline-utils
Gathering detailed insights and metrics for readline-utils
Gathering detailed insights and metrics for readline-utils
Gathering detailed insights and metrics for readline-utils
npm install readline-utils
Typescript
Module System
Min. Node Version
Node Version
NPM Version
JavaScript (100%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
18 Stars
64 Commits
1 Forks
4 Watchers
1 Branches
5 Contributors
Updated on Dec 25, 2021
Latest Version
2.2.3
Package Id
readline-utils@2.2.3
Size
8.43 kB
NPM Version
4.6.1
Node Version
6.10.1
Published on
Jul 11, 2017
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
9
2
Readline utils, for moving the cursor, clearing lines, creating a readline interface, and more.
Install with npm:
1$ npm install --save readline-utils
1var utils = require('readline-utils');
Create a readline interface with the given options
.
Params
options
{Object}Move cursor up by n
lines.
Params
rl
{Readline}: Readline interfacen
{Number}: Lines up to move. Default is 1
.Move cursor down by n
lines.
Params
rl
{Readline}: Readline interfacen
{Number}: Lines down to move. Default is 1
.Move cursor left by n
colums.
Params
rl
{Readline}: Readline interfacen
{Number}: Characters to move left. Default is 1
.Move cursor right by n
colums.
Params
rl
{Readline}: Readline interfacen
{Number}: Characters to move right. Default is 1
.Move cursor up, down, left or right by 1
line.
Params
rl
{Readline}: Readline interfaceExample
1var utils = require('readline-utils'); 2var rl = utils.createInterface(); 3rl.input.on('keypress', function(str, key) { 4 utils.move(rl, key); 5});
Callback function for the keypress
event, to automatically move cursor up, down, left or right by 1
line.
Params
rl
{Readline}: Readline interfaceExample
1var utils = require('readline-utils'); 2var rl = utils.createInterface(); 3rl.input.on('keypress', utils.auto(rl));
Clear n
lines after the cursor.
Params
rl
{Readline}: Readline interfacen
{Number}: Number of lines to clearClear the terminal.
Params
rl
{Readline}: Readline interfacen
{Number}: Number of lines to clearGet the last line from the given str
Params
str
{String}returns
{String}Get the height (rows) of the given str
Params
str
{String}returns
{Number}Hide the cursor so it doesn't show during a prompt. This is useful for multiple-choice or list prompts, or any prompt where the user will not be entering input.
Params
rl
{Readline}: Readline interfacereturns
{Object}: readline-utils object for chainingShow the cursor.
Params
rl
{Readline}: Readline interfacereturns
{Object}: readline-utils object for chainingClose the interface, remove event listeners, and restore/unmute prompt functionality
Params
rl
{Readline}: Readline interfacereturns
{Object}: readline-utils object for chainingClose the interface when the keypress is ^C
Params
rl
{Readline}: Readline interfacereturns
{Object}: readline-utils object for chainingErase n
lines
Params
n
{Number}returns
{String}: Returns the unicode to erase linesExample
1utils.eraseLines(3);
Remove lines from the bottom of the terminal.
Params
rl
{Number}: Readline interfacelines
{Number}: Number of lines to removeheight
{Number}: Content heightreturns
{Object}: Returns the readline-utils object for chainingRemember the cursor position
returns
{Object}: readline-utils objectRestore the cursor position to where it has been previously stored.
returns
{Object}: readline-utils objectGet the width of the terminal
returns
{Number}: Returns the number of columns.Break lines longer than the cli width so we can normalize the natural line returns behavior accross terminals. (I don't see how this can work consistently. It seems brittle and will probably be replaced with https://github.com/jonschlinkert/word-wrap)
Params
lines
{Array}: Array of lineswidth
{Number}: Terminal widthJoins the lines returned from .breakLines.
Params
lines
{Array|String}: String or array of lines.width
{Number}: Terminal widthreturns
{String}Ensure the given str
ends in a newline.
Params
str
{String}: The input stringreturns
{String}Example
1console.log(utils.normalizeLF('foo')); 2//=> 'foo\n'
This module offers the internal "keypress" functionality from node-core's readline
module, for your own programs and modules to use.
The keypress
function accepts a readable Stream instance and makes it
emit "keypress" events.
Usage:
Params
Example
1require('keypress')(process.stdin); 2 3process.stdin.on('keypress', function(ch, key) { 4 console.log(ch, key); 5 if (key.ctrl && key.name === 'c') { 6 process.stdin.pause(); 7 } 8}); 9proces.stdin.resume();
Enables "mousepress" events on the input stream. Note
that stream
must be an output stream (i.e. a Writable
Stream instance), usually process.stdout
.
Params
Disables "mousepress" events from being sent to the input
stream. Note that stream
must be an output stream (i.e.
a Writable Stream instance), usually process.stdout
.
Params
Some of this code was initially borrowed from [Inquirer][].
Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.
Please read the contributing guide for advice on opening issues, pull requests, and coding standards.
Commits | Contributor |
---|---|
41 | jonschlinkert |
7 | doowb |
(This project's readme.md is generated by verb, please don't edit the readme directly. Any changes to the readme must be made in the .verb.md readme template.)
To generate the readme, run the following command:
1$ npm install -g verbose/verb#dev verb-generate-readme && verb
Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command:
1$ npm install && npm test
Jon Schlinkert
Copyright © 2017, Jon Schlinkert. Released under the MIT License.
This file was generated by verb-generate-readme, v0.6.0, on May 21, 2017.
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
Reason
Found 0/22 approved changesets -- score normalized to 0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
security policy file not detected
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2025-07-14
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More