Skip to content

coderaiser/redstd

redstd License NPM version Build Status Coverage Status

Read stdin to have ability to use pipes like: cat README.md | less or

cat README.md | node -e "const {readStdin} = await import('redstd'); console.log(await readStdin())"

When you pass nothing to stdin - everything just works, so you can read from stdout or from file

Install

npm i redstd

Usage

import {readFile} from 'node:fs/promises';
import {readStdin} from 'redstd';

const input = await readStdin();

if (!input) {
    console.log(await readFile('./README.md'));
    process.exit();
}

console.log(input);

License

MIT

About

read stdin in a simplest possible way

Resources

License

Code of conduct

Contributing

Stars

Watchers

Forks

Packages

 
 
 

Contributors