0.0.3 • Published 7 months ago

@aux4/input v0.0.3

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
7 months ago

input

Read STDIN input

Install

npm install @aux4/input

Usage

Read stdin as String

const Input = require('@aux4/input');

const string = await Input.readAsString();

Read stdin as JSON

const Input = require('@aux4/input');

const json = await Input.readAsJson();

...

const nested = await Input.readAsJson("$.nested");

Stream stdin as JSON

const Input = require('@aux4/input');

const stream = Input.stream();
stream.on('data', (data) => {
  // data is a JSON object
});

...

const stream = Input.stream("$.nested");
stream.on('data', (data) => {
  // data is a JSON object
});