1.0.2 • Published 11 months ago

sinp v1.0.2

Weekly downloads
-
License
Apache-2.0
Repository
-
Last release
11 months ago

Sinp

A simple standard input reader

Installation

npm i sinp

Usage

const input = reqiure('sinp');

(async function () {
    const inp = input('> ');
    console.log('You said:', await inp);
})();

Sinp can also be used with .then:

input('> ').then(function (inp) {
    console.log('You said:', inp);
});

The "prompt" parameter is optional, and defaults to an empty string.

Sinp can also output a buffer instead of a string for more control:

input('> ', true).then(function (inp) {
    console.log(inp.toString().trim()); // Buffer mode won't trim the input
});

Motivation

A lot of other stdin readers are bloated with features that often aren't used. Sinp was created to be a simple input reader with no extra features or dependencies. Sinp doesn't even depend on readlines.

1.0.2

11 months ago

1.0.1

12 months ago

1.0.0

12 months ago