summaryrefslogtreecommitdiff
path: root/node_modules/get-stdin
diff options
context:
space:
mode:
authorLinuxWizard42 <computerwizard@linuxmail.org>2022-10-12 22:54:37 +0300
committerLinuxWizard42 <computerwizard@linuxmail.org>2022-10-12 22:54:37 +0300
commit703e03aba33f234712206769f57717ba7d92d23d (patch)
tree0041f04ccb75bd5379c764e9fe42249fffe75fc3 /node_modules/get-stdin
parentab6e257e6e9d9a483d7e86f220d8b209a2cd7753 (diff)
downloadFlashRunner-703e03aba33f234712206769f57717ba7d92d23d.tar.gz
FlashRunner-703e03aba33f234712206769f57717ba7d92d23d.tar.zst
Added export_allowed file to make repository visible in cgit
Diffstat (limited to 'node_modules/get-stdin')
-rw-r--r--node_modules/get-stdin/index.js49
-rw-r--r--node_modules/get-stdin/package.json35
-rw-r--r--node_modules/get-stdin/readme.md44
3 files changed, 128 insertions, 0 deletions
diff --git a/node_modules/get-stdin/index.js b/node_modules/get-stdin/index.js
new file mode 100644
index 0000000..0f1aeb3
--- /dev/null
+++ b/node_modules/get-stdin/index.js
@@ -0,0 +1,49 @@
+'use strict';
+
+module.exports = function (cb) {
+ var stdin = process.stdin;
+ var ret = '';
+
+ if (stdin.isTTY) {
+ setImmediate(cb, '');
+ return;
+ }
+
+ stdin.setEncoding('utf8');
+
+ stdin.on('readable', function () {
+ var chunk;
+
+ while (chunk = stdin.read()) {
+ ret += chunk;
+ }
+ });
+
+ stdin.on('end', function () {
+ cb(ret);
+ });
+};
+
+module.exports.buffer = function (cb) {
+ var stdin = process.stdin;
+ var ret = [];
+ var len = 0;
+
+ if (stdin.isTTY) {
+ setImmediate(cb, new Buffer(''));
+ return;
+ }
+
+ stdin.on('readable', function () {
+ var chunk;
+
+ while (chunk = stdin.read()) {
+ ret.push(chunk);
+ len += chunk.length;
+ }
+ });
+
+ stdin.on('end', function () {
+ cb(Buffer.concat(ret, len));
+ });
+};
diff --git a/node_modules/get-stdin/package.json b/node_modules/get-stdin/package.json
new file mode 100644
index 0000000..9a3e42a
--- /dev/null
+++ b/node_modules/get-stdin/package.json
@@ -0,0 +1,35 @@
+{
+ "name": "get-stdin",
+ "version": "4.0.1",
+ "description": "Easier stdin",
+ "license": "MIT",
+ "repository": "sindresorhus/get-stdin",
+ "author": {
+ "name": "Sindre Sorhus",
+ "email": "sindresorhus@gmail.com",
+ "url": "http://sindresorhus.com"
+ },
+ "engines": {
+ "node": ">=0.10.0"
+ },
+ "scripts": {
+ "test": "node test.js && node test-buffer.js && echo unicorns | node test-real.js"
+ },
+ "files": [
+ "index.js"
+ ],
+ "keywords": [
+ "std",
+ "stdin",
+ "stdio",
+ "concat",
+ "buffer",
+ "stream",
+ "process",
+ "stream"
+ ],
+ "devDependencies": {
+ "ava": "0.0.4",
+ "buffer-equal": "0.0.1"
+ }
+}
diff --git a/node_modules/get-stdin/readme.md b/node_modules/get-stdin/readme.md
new file mode 100644
index 0000000..bc1d32a
--- /dev/null
+++ b/node_modules/get-stdin/readme.md
@@ -0,0 +1,44 @@
+# get-stdin [![Build Status](https://travis-ci.org/sindresorhus/get-stdin.svg?branch=master)](https://travis-ci.org/sindresorhus/get-stdin)
+
+> Easier stdin
+
+
+## Install
+
+```sh
+$ npm install --save get-stdin
+```
+
+
+## Usage
+
+```js
+// example.js
+var stdin = require('get-stdin');
+
+stdin(function (data) {
+ console.log(data);
+ //=> unicorns
+});
+```
+
+```sh
+$ echo unicorns | node example.js
+unicorns
+```
+
+
+## API
+
+### stdin(callback)
+
+Get `stdin` as a string.
+
+### stdin.buffer(callback)
+
+Get `stdin` as a buffer.
+
+
+## License
+
+MIT © [Sindre Sorhus](http://sindresorhus.com)