mirror of
https://code.forgejo.org/actions/setup-node.git
synced 2025-05-20 13:14:44 +00:00
.
This commit is contained in:
parent
fc725ba36b
commit
422b9fdb15
7395 changed files with 1786235 additions and 3476 deletions
33
node_modules/get-stdin/index.d.ts
generated
vendored
Normal file
33
node_modules/get-stdin/index.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,33 @@
|
|||
/// <reference types="node"/>
|
||||
|
||||
declare const getStdin: {
|
||||
/**
|
||||
Get [`stdin`](https://nodejs.org/api/process.html#process_process_stdin) as a `string`.
|
||||
|
||||
@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. In a TTY context, an empty `string` is returned.
|
||||
|
||||
@example
|
||||
```
|
||||
// example.ts
|
||||
import getStdin = require('get-stdin');
|
||||
|
||||
(async () => {
|
||||
console.log(await getStdin());
|
||||
//=> 'unicorns'
|
||||
})
|
||||
|
||||
// $ echo unicorns | ts-node example.ts
|
||||
// unicorns
|
||||
```
|
||||
*/
|
||||
(): Promise<string>;
|
||||
|
||||
/**
|
||||
Get [`stdin`](https://nodejs.org/api/process.html#process_process_stdin) as a `Buffer`.
|
||||
|
||||
@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. In a TTY context, an empty `Buffer` is returned.
|
||||
*/
|
||||
buffer(): Promise<Buffer>;
|
||||
};
|
||||
|
||||
export = getStdin;
|
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';
|
||||
const {stdin} = process;
|
||||
|
||||
module.exports = () => {
|
||||
let result = '';
|
||||
|
||||
return new Promise(resolve => {
|
||||
if (stdin.isTTY) {
|
||||
resolve(result);
|
||||
return;
|
||||
}
|
||||
|
||||
stdin.setEncoding('utf8');
|
||||
|
||||
stdin.on('readable', () => {
|
||||
let chunk;
|
||||
|
||||
while ((chunk = stdin.read())) {
|
||||
result += chunk;
|
||||
}
|
||||
});
|
||||
|
||||
stdin.on('end', () => {
|
||||
resolve(result);
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
module.exports.buffer = () => {
|
||||
const result = [];
|
||||
let length = 0;
|
||||
|
||||
return new Promise(resolve => {
|
||||
if (stdin.isTTY) {
|
||||
resolve(Buffer.concat([]));
|
||||
return;
|
||||
}
|
||||
|
||||
stdin.on('readable', () => {
|
||||
let chunk;
|
||||
|
||||
while ((chunk = stdin.read())) {
|
||||
result.push(chunk);
|
||||
length += chunk.length;
|
||||
}
|
||||
});
|
||||
|
||||
stdin.on('end', () => {
|
||||
resolve(Buffer.concat(result, length));
|
||||
});
|
||||
});
|
||||
};
|
9
node_modules/get-stdin/license
generated
vendored
Normal file
9
node_modules/get-stdin/license
generated
vendored
Normal file
|
@ -0,0 +1,9 @@
|
|||
MIT License
|
||||
|
||||
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.
|
43
node_modules/get-stdin/package.json
generated
vendored
Normal file
43
node_modules/get-stdin/package.json
generated
vendored
Normal file
|
@ -0,0 +1,43 @@
|
|||
{
|
||||
"name": "get-stdin",
|
||||
"version": "7.0.0",
|
||||
"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": ">=8"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && ava test.js test-buffer.js && echo unicorns | node test-real.js && tsd"
|
||||
},
|
||||
"files": [
|
||||
"index.js",
|
||||
"index.d.ts"
|
||||
],
|
||||
"keywords": [
|
||||
"std",
|
||||
"stdin",
|
||||
"stdio",
|
||||
"concat",
|
||||
"buffer",
|
||||
"stream",
|
||||
"process",
|
||||
"read"
|
||||
],
|
||||
"devDependencies": {
|
||||
"@types/node": "^11.13.4",
|
||||
"ava": "^1.4.1",
|
||||
"delay": "^4.2.0",
|
||||
"tsd": "^0.7.2",
|
||||
"xo": "^0.24.0"
|
||||
}
|
||||
|
||||
,"_resolved": "https://registry.npmjs.org/get-stdin/-/get-stdin-7.0.0.tgz"
|
||||
,"_integrity": "sha512-zRKcywvrXlXsA0v0i9Io4KDRaAw7+a1ZpjRwl9Wox8PFlVCCHra7E9c4kqXCoCM9nR5tBkaTTZRBoCm60bFqTQ=="
|
||||
,"_from": "get-stdin@7.0.0"
|
||||
}
|
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 get-stdin
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
// example.js
|
||||
const getStdin = require('get-stdin');
|
||||
|
||||
(async () => {
|
||||
console.log(await getStdin());
|
||||
//=> '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](https://sindresorhus.com)
|
Loading…
Add table
Add a link
Reference in a new issue