sindresorhus / get-stdin

Get stdin as a string or buffer
MIT License
337 stars 28 forks source link

Reading JSON File from stdin #30

Closed malikkamranabid closed 4 years ago

malikkamranabid commented 4 years ago

How do i read JSON file by using this package. I am using following command to get stdin but using this package it does-not work. cat airlines/british_airways/example_input.json | tsc && node dist/index.js

sindresorhus commented 4 years ago
const getStdin = require('get-stdin');

(async () => {
    console.log(JSON.parse(await getStdin()));
    //=> {foo: true}
})();
malikkamranabid commented 4 years ago

Thanks