New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

readline-store

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

readline-store

A simple synchronous-style readline interface for Node.js

latest
Source
npmnpm
Version
1.0.0
Version published
Maintainers
1
Created
Source

readline-store

A simple synchronous-style readline interface for Node.js

Installation

npm install readline-store

Features

  • Simple promise-based interface
  • Proper cleanup on process exit
  • Error handling
  • No external dependencies

Usage

Basic Example

import rl from 'readline-store';

async function main() {
    const name = await rl('What is your name? ');
    console.log(`Hello, ${name}!`);
}

main();

Multiple Questions

import rl from 'readline-store';

async function survey() {
    const name = await rl('Enter your name: ');
    const age = await rl('Enter your age: ');
    console.log(`Hello ${name}, you are ${age} years old!`);
}

survey();

Error Handling

try {
    const input = await rl('Enter something: ');
} catch (err) {
    console.error('Input error:', err);
}

API

rl(query: string): Promise<string>

  • query: The prompt string to display
  • Returns: Promise that resolves with user input

Why?

This package provides a minimal, robust wrapper around Node.js's readline module with:

  • Proper resource cleanup
  • Consistent behavior during process interruption
  • Simple promise-based API

License

MIT

Keywords

readline

FAQs

Package last updated on 02 Apr 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts