Vangware's Prompts logo

Coverage License NPM Version Open Issues

❓ CLI interactive prompts. Currently just wrapping the question method of Node's readline module. This obviously makes this package "Node only", even if it uses ESM.



# If you use npm
npm install @vangware/prompts
# If you use pnpm
pnpm add @vangware/prompts
# If you use yarn
yarn add @vangware/prompts

And then:

import { question } from "@vangware/prompts";
import { createInterface } from "node:readline/promises";

const readlineInterface = createInterface({
input: process.stdin,
output: process.stdout,

format: value => parseInt(value, 18),
query: "How old are you?",
validate: value => (value < 18 ? "You must be at least 18 years old." : ""),
.finally(() => readlineInterface.close());


Documentation is available HERE. It is auto-generated with typedoc based on the JSDocs and the types in the source. It shouldn't be necessary to read this. Code editors like VS Code integrate the documentation in the UI.


Changelog can be found HERE.

Test coverage

Test coverage can be found HERE.