{"_id":"get-stdin-with-tty","_rev":"5-a3bbcbcd9cd8ef17d9607b1649d26059","name":"get-stdin-with-tty","description":"Get stdin as a string or buffer from pipe or TTY","dist-tags":{"latest":"6.0.0"},"versions":{"5.0.2":{"name":"get-stdin-with-tty","version":"5.0.2","description":"Get stdin as a string or buffer from pipe or TTY","license":"MIT","repository":{"type":"git","url":"git+https://github.com/moos/get-stdin.git"},"author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"sindresorhus.com"},"engines":{"node":">=0.12.0"},"scripts":{"test":"xo && ava --verbose test.js && ava --verbose test-tty.js && echo unicorns | node test-real.js"},"files":["index.js"],"keywords":["std","stdin","stdio","concat","buffer","stream","process","read"],"devDependencies":{"ava":"^0.9.0","buffer-equals":"^1.0.3","xo":"*"},"contributors":[{"name":"Moos","email":"mooster@42at.com","url":"http://github.com/moos"}],"gitHead":"ee872b7e372f4fdd827ac86906d723926e55618d","bugs":{"url":"https://github.com/moos/get-stdin/issues"},"homepage":"https://github.com/moos/get-stdin#readme","_id":"get-stdin-with-tty@5.0.2","_shasum":"af85aa79f2dbe43f01382b180021e407239fc349","_from":".","_npmVersion":"2.14.12","_nodeVersion":"4.2.4","_npmUser":{"name":"moos","email":"mooster@42at.com"},"maintainers":[{"name":"moos","email":"mooster@42at.com"}],"dist":{"shasum":"af85aa79f2dbe43f01382b180021e407239fc349","tarball":"https://registry.npmjs.org/get-stdin-with-tty/-/get-stdin-with-tty-5.0.2.tgz","integrity":"sha512-yL5xfMH80P0/RrmR9WLdk1IliCMdGEvGSXuAuOJ+X7lAZ/9CXENBZYoguLFaRb5PyU0QXYxzRKV0m7e0QNIFLQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDggYeJxtxpGuTTNddCNDEvAbzF/+sRZbG6f5IG+2bgiAIhAOlqX+z0Wsct3XDg0e0a44GGP2r0bnAmw4bUP5gScU1D"}]},"directories":{}},"6.0.0":{"name":"get-stdin-with-tty","version":"6.0.0","description":"Get stdin as a string or buffer from pipe or TTY","license":"MIT","repository":{"type":"git","url":"git+https://github.com/moos/get-stdin-with-tty.git"},"author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"sindresorhus.com"},"engines":{"node":">=8"},"scripts":{"test":"xo && ava --verbose test.js test-buffer.js && ava --verbose test-tty.js && echo unicorns | node test-real.js && tsd"},"ava":{"require":["esm"],"timeout":"3s"},"keywords":["std","stdin","stdio","concat","buffer","stream","process","read","tty"],"devDependencies":{"@types/node":"^13.9.2","ava":"^1.4.1","delay":"^4.3.0","esm":"3.2.25","tsd":"^0.7.2","xo":"^0.24.0"},"contributors":[{"name":"Moos","email":"mooster@42at.com","url":"http://github.com/moos"},{"name":"prantlf","url":"https://github.com/prantlf"}],"gitHead":"62f7cbeb9b05ad0756818c49c5616c9e2dd21911","bugs":{"url":"https://github.com/moos/get-stdin-with-tty/issues"},"homepage":"https://github.com/moos/get-stdin-with-tty#readme","_id":"get-stdin-with-tty@6.0.0","_nodeVersion":"12.16.1","_npmVersion":"6.13.4","dist":{"integrity":"sha512-QY6Xh/uF+jRiXwDOcQbmYV+Mb09WoxGrH0TV8sooHIIsVKA5jv5zNkMjqW1SSuNOcwUbBirBFyPYG2kQa62EBw==","shasum":"f11a70136246a50b86ea8b7532a096068f3f04da","tarball":"https://registry.npmjs.org/get-stdin-with-tty/-/get-stdin-with-tty-6.0.0.tgz","fileCount":5,"unpackedSize":7951,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeeBSKCRA9TVsSAnZWagAAx8wP/jqvwML76EEuDTTpIHj+\nKiUnRPnwRCDi4olYfs5sDri4iJ+I48JMBdplD6jGKCsHCEokDIuzGun3Q3YA\n3PqSppfbkQ/ahEiXessY7fjHMW6dxSs84YZak15hAi1ygcF7KSye5UYyXISK\n+N+aFSzrBV9nYGvhrFIyGyRFr+FmWL076lc4KUQ19X+yjBD4urHqgEs9aoJf\nnibXkB0Ao0E3cncktGGq+3TSGHhnmAsgfqyHHcgfyxgHnZVg8jwHPylvDnZd\nlKTuDANh42L1v6aeumetRnQzIjXiIUqIyLgZYpSOxvoBiBSkmIUQUolss5df\ncS1P4qKVzHbYYzMgIEcqkmRmPxB6kXMY39zWug800HH35w22cB6c+FjGsV/3\ng/eA35lP4WuPBRojOevbbIRBe2vX6WDMF+4JFRAYOLC/5tdTwwvVBsZVT74c\nZOPxiEnzLkXktkr8P8PFI646pLcS8rmewSmm7UoTQVzoETXdMuYB+IbsNp41\nSiFcHT4+gvoJBb/FyzZqV7dqZ6ba9h74fSeOaa2HTFkBFkettdyBtpBuyDqj\nxEoZpzZqvmRW/xwW5lkCgg6udtZf0u2HUFCoBVTERX1yGp35lwq7Zdw5uPRJ\nSlaGPRzed1ETdkgTcOHJZGamqLcl/olxbBukDYrIrUElRhnk0Tfa1IKs6JuV\nn0RX\r\n=S/EQ\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQC1wShBuegr+2MUo5g4ktyY+fBzKBv/lcAo1tJcxolzWAIgNVEMTWSXu60c2ajEuTkTUGfzDeHl4OccMYkATLGGQ4s="}]},"maintainers":[{"name":"moos","email":"mooster@42at.com"}],"_npmUser":{"name":"moos","email":"mooster@42at.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/get-stdin-with-tty_6.0.0_1584927881813_0.6755069460959724"},"_hasShrinkwrap":false}},"readme":"# get-stdin-with-tty\n\n[![NPM version](https://img.shields.io/npm/v/get-stdin-with-tty.svg)](https://www.npmjs.com/package/get-stdin-with-tty)\n[![Build Status](https://travis-ci.org/moos/get-stdin-with-tty.svg?branch=master)](https://travis-ci.org/github/moos/get-stdin-with-tty)\n\n> Get [stdin](https://nodejs.org/api/process.html#process_process_stdin) as a string or buffer\n\n## Install\n\n```\n$ npm install get-stdin-with-tty\n```\n\n## Usage\n\n```js\n// example.js\nconst getStdin = require('get-stdin-with-tty');\n\n(async () => {\n\tconsole.log(await getStdin());\n})();\n```\n\n```\n$ echo unicorns | node example.js\nunicorns\n```\n\n## API\n\nBoth methods returns a promise that is resolved when the `end` event fires on the `stdin` stream, indicating that there is no more data to be read.\n\n### getStdin(options) ← Promise&lt;String&gt;\n\nGet `stdin` as a `string`.\n\nIn a TTY context, a promise that resolves to an empty string is returned, unless `options.tty` or `getStdin.tty` is true.\n\n### getStdin.buffer()  ← Promise&lt;Buffer&gt;\n\nGet `stdin` as a `Buffer`.\n\nIn a TTY context, a promise that resolves to an empty `Buffer` is returned.\n\n### Options / Settings\n\n- `tty` | `getStdin.tty` (Boolean) -\n   Set global TTY handling.  When true, accepts input from TTY until a new line beginning with Ctrl-d or Ctrl-z is entered.  Double Ctrl-d [anywhere in the line](https://stackoverflow.com/a/21261742/302177) also ends the stream. (Default = `true`)\n\n   When enabled for the example above:\n\t```\n\t$ node example.js\n\tfoobar\n\tbarfoo\n\t^d\n\t// =>\n\tfoobar\n\tbarfoo\n\t```\n\n- `EOF` | `getStdin.EOF` (String) - The end-of-file (aka [EOT](https://en.wikipedia.org/wiki/End-of-Transmission_character)) character to use to signal end of stream.  Defaults to **Ctrl-d** on \\*nix and cygwin, and **Ctrl-z** on Windows.  Acceptable values:\n    - `getStdin.CTRL_D` - Ctrl-d (ASCII 04)\n    - `getStdin.CTRL_Z` - Ctrl-z (ASCII 26)\n    - `'*'` - Use both Ctrl-d and Ctrl-z\n\n\t```shell\n\t(win) c:\\> node example.js\n\tfoobar\n\t^z\n\t# => foobar\n\t```\n\t```bash\n\t$ node example.js\n\tfoobar^d^d\n\t# => foobar\n\t```\n\n## Moos Fork\n\nThe [moos fork](https://github.com/moos/get-stdin) includes support for reading stdin from TTY by default.\n\n## Related\n\n- [get-stream](https://github.com/sindresorhus/get-stream) - Get a stream as a string or buffer\n\n## Change log\n\n- 6.0.0 - `tty` option is now defaulted to `true`. Double Ctrl-d in middle of line also ends stream.\n- 5.0.2 - Initial fork.\n\n## License\n\nMIT © [Sindre Sorhus](http://sindresorhus.com)\n© [Moos](http://github.com/moos)\n","maintainers":[{"name":"moos","email":"mooster@42at.com"}],"time":{"modified":"2022-06-18T07:55:13.753Z","created":"2016-01-07T06:33:13.221Z","5.0.2":"2016-01-07T06:33:13.221Z","6.0.0":"2020-03-23T01:44:41.946Z"},"homepage":"https://github.com/moos/get-stdin-with-tty#readme","keywords":["std","stdin","stdio","concat","buffer","stream","process","read","tty"],"repository":{"type":"git","url":"git+https://github.com/moos/get-stdin-with-tty.git"},"contributors":[{"name":"Moos","email":"mooster@42at.com","url":"http://github.com/moos"},{"name":"prantlf","url":"https://github.com/prantlf"}],"author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"sindresorhus.com"},"bugs":{"url":"https://github.com/moos/get-stdin-with-tty/issues"},"license":"MIT","readmeFilename":"readme.md"}