Dia antes primera install
This commit is contained in:
52
node_modules/get-stdin/index.js
generated
vendored
Normal file
52
node_modules/get-stdin/index.js
generated
vendored
Normal file
@@ -0,0 +1,52 @@
|
||||
'use strict';
|
||||
var stdin = process.stdin;
|
||||
|
||||
module.exports = function () {
|
||||
var ret = '';
|
||||
|
||||
return new Promise(function (resolve) {
|
||||
if (stdin.isTTY) {
|
||||
resolve(ret);
|
||||
return;
|
||||
}
|
||||
|
||||
stdin.setEncoding('utf8');
|
||||
|
||||
stdin.on('readable', function () {
|
||||
var chunk;
|
||||
|
||||
while ((chunk = stdin.read())) {
|
||||
ret += chunk;
|
||||
}
|
||||
});
|
||||
|
||||
stdin.on('end', function () {
|
||||
resolve(ret);
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
module.exports.buffer = function () {
|
||||
var ret = [];
|
||||
var len = 0;
|
||||
|
||||
return new Promise(function (resolve) {
|
||||
if (stdin.isTTY) {
|
||||
resolve(new Buffer(''));
|
||||
return;
|
||||
}
|
||||
|
||||
stdin.on('readable', function () {
|
||||
var chunk;
|
||||
|
||||
while ((chunk = stdin.read())) {
|
||||
ret.push(chunk);
|
||||
len += chunk.length;
|
||||
}
|
||||
});
|
||||
|
||||
stdin.on('end', function () {
|
||||
resolve(Buffer.concat(ret, len));
|
||||
});
|
||||
});
|
||||
};
|
||||
21
node_modules/get-stdin/license
generated
vendored
Normal file
21
node_modules/get-stdin/license
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
41
node_modules/get-stdin/package.json
generated
vendored
Normal file
41
node_modules/get-stdin/package.json
generated
vendored
Normal file
@@ -0,0 +1,41 @@
|
||||
{
|
||||
"name": "get-stdin",
|
||||
"version": "5.0.1",
|
||||
"description": "Get stdin as a string or buffer",
|
||||
"license": "MIT",
|
||||
"repository": "sindresorhus/get-stdin",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "sindresorhus.com"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.12.0"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && ava test.js && echo unicorns | ava test-real.js"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"keywords": [
|
||||
"std",
|
||||
"stdin",
|
||||
"stdio",
|
||||
"concat",
|
||||
"buffer",
|
||||
"stream",
|
||||
"process",
|
||||
"read"
|
||||
],
|
||||
"devDependencies": {
|
||||
"ava": "*",
|
||||
"buffer-equals": "^1.0.3",
|
||||
"xo": "*"
|
||||
},
|
||||
"xo": {
|
||||
"ignores": [
|
||||
"test.js"
|
||||
]
|
||||
}
|
||||
}
|
||||
55
node_modules/get-stdin/readme.md
generated
vendored
Normal file
55
node_modules/get-stdin/readme.md
generated
vendored
Normal file
@@ -0,0 +1,55 @@
|
||||
# get-stdin [](https://travis-ci.org/sindresorhus/get-stdin)
|
||||
|
||||
> Get [stdin](https://nodejs.org/api/process.html#process_process_stdin) as a string or buffer
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install --save get-stdin
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
// example.js
|
||||
const getStdin = require('get-stdin');
|
||||
|
||||
getStdin().then(str => {
|
||||
console.log(str);
|
||||
//=> 'unicorns'
|
||||
});
|
||||
```
|
||||
|
||||
```
|
||||
$ echo unicorns | node example.js
|
||||
unicorns
|
||||
```
|
||||
|
||||
|
||||
## API
|
||||
|
||||
Both 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.
|
||||
|
||||
### getStdin()
|
||||
|
||||
Get `stdin` as a string.
|
||||
|
||||
In a TTY context, a promise that resolves to an empty string is returned.
|
||||
|
||||
### getStdin.buffer()
|
||||
|
||||
Get `stdin` as a buffer.
|
||||
|
||||
In a TTY context, a promise that resolves to an empty buffer is returned.
|
||||
|
||||
|
||||
## Related
|
||||
|
||||
- [get-stream](https://github.com/sindresorhus/get-stream) - Get a stream as a string or buffer
|
||||
|
||||
|
||||
## License
|
||||
|
||||
MIT © [Sindre Sorhus](http://sindresorhus.com)
|
||||
Reference in New Issue
Block a user