MCPcopy Create free account
hub / github.com/SmartThingsCommunity/smartthings-cli / readDataFromStdin

Function readDataFromStdin

src/lib/io-util.ts:39–55  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

37}
38
39export function readDataFromStdin(): Promise<string> {
40 return new Promise((resolve, reject) => {
41 try {
42 const stdin = process.stdin
43 const inputChunks: string[] = []
44 stdin.resume()
45 stdin.on('data', chunk => {
46 inputChunks.push(chunk.toString())
47 })
48 stdin.on('end', () => {
49 resolve(inputChunks.join(''))
50 })
51 } catch (error) {
52 reject(error)
53 }
54 })
55}
56
57/**
58 * Simple function to test for TTY input. Use this instead of directly calling `process` if you want

Callers 2

hasInputFunction · 0.85
io-util.test.tsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected