Socket
Socket
Sign inDemoInstall

get-stdin

Package Overview
Dependencies
0
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 6.0.0 to 7.0.0

index.d.ts

20

index.js
'use strict';
const stdin = process.stdin;
const {stdin} = process;
module.exports = () => {
let ret = '';
let result = '';
return new Promise(resolve => {
if (stdin.isTTY) {
resolve(ret);
resolve(result);
return;

@@ -19,3 +19,3 @@ }

while ((chunk = stdin.read())) {
ret += chunk;
result += chunk;
}

@@ -25,3 +25,3 @@ });

stdin.on('end', () => {
resolve(ret);
resolve(result);
});

@@ -32,4 +32,4 @@ });

module.exports.buffer = () => {
const ret = [];
let len = 0;
const result = [];
let length = 0;

@@ -46,4 +46,4 @@ return new Promise(resolve => {

while ((chunk = stdin.read())) {
ret.push(chunk);
len += chunk.length;
result.push(chunk);
length += chunk.length;
}

@@ -53,5 +53,5 @@ });

stdin.on('end', () => {
resolve(Buffer.concat(ret, len));
resolve(Buffer.concat(result, length));
});
});
};
{
"name": "get-stdin",
"version": "6.0.0",
"version": "7.0.0",
"description": "Get stdin as a string or buffer",

@@ -13,9 +13,10 @@ "license": "MIT",

"engines": {
"node": ">=4"
"node": ">=8"
},
"scripts": {
"test": "xo && ava test.js test-buffer.js && echo unicorns | node test-real.js"
"test": "xo && ava test.js test-buffer.js && echo unicorns | node test-real.js && tsd"
},
"files": [
"index.js"
"index.js",
"index.d.ts"
],

@@ -33,5 +34,8 @@ "keywords": [

"devDependencies": {
"ava": "*",
"xo": "*"
"@types/node": "^11.13.4",
"ava": "^1.4.1",
"delay": "^4.2.0",
"tsd": "^0.7.2",
"xo": "^0.24.0"
}
}

@@ -19,6 +19,6 @@ # get-stdin [![Build Status](https://travis-ci.org/sindresorhus/get-stdin.svg?branch=master)](https://travis-ci.org/sindresorhus/get-stdin)

getStdin().then(str => {
console.log(str);
(async () => {
console.log(await getStdin());
//=> 'unicorns'
});
})();
```

@@ -40,3 +40,3 @@

In a TTY context, a promise that resolves to an empty string is returned.
In a TTY context, a promise that resolves to an empty `string` is returned.

@@ -47,3 +47,3 @@ ### getStdin.buffer()

In a TTY context, a promise that resolves to an empty buffer is returned.
In a TTY context, a promise that resolves to an empty `Buffer` is returned.

@@ -50,0 +50,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc