Last 12 weeks · 0 commits
4 of 6 standards met
What's the point of behaving differently depending if stdin is a terminal or not? I think this is not the intended default behaviour and it should be left optional to the user. But if I run getStdin() i expect to slurp until EOF happens, even if thats typed by the user or coming from a pipe. https://github.com/sindresorhus/get-stdin/blob/master/index.js#L34
If there is no file option set my CLI app falls back to . I check if the result of the file read or is falsey and if so I show the help message. This works fine when used for real in a shell but when I try to write a test for it, it just hangs. It seems if I spawn my CLI app from node, returns a promise that never resolves. For example: But if I run this from node: I get nothing. Not sure if possibly related to #1. Is this expected behaviour or a bug?
Added in v16.7.0, there's now a function that returns a promise similar to from the API. https://nodejs.org/api/webstreams.html#utility-consumers ex: I think it would be a good idea to add a note (not necessarily a recommendation one way or the other; just a a note) to inform users of this alternative native Node.js way to get stdin as a string. This is just an idea and you may not want to add this and instead keep the readme very deliberately bare. idk. This is just a suggestion.
Repository: sindresorhus/get-stdin. Description: Get stdin as a string or buffer Stars: 350, Forks: 29. Primary language: JavaScript. Languages: JavaScript (100%). License: MIT. Latest release: v10.0.0 (6mo ago). Open PRs: 0, open issues: 0. Last activity: 6mo ago. Community health: 85%. Top contributors: sindresorhus, kevva, coreyfarrell, BendingBender, Ethan-Arrowood, javiercejudo, lukechilds, ntwb, fisker, ChALkeR.