Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

get-stdin

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

get-stdin - npm Package Compare versions

Comparing version 3.0.2 to 4.0.0

30

index.js
'use strict';
module.exports = function (cb) {
var stdin = process.stdin;
var ret = '';
if (process.stdin.isTTY) {
if (stdin.isTTY) {
cb('');

@@ -11,9 +12,13 @@ return;

process.stdin.setEncoding('utf8');
stdin.setEncoding('utf8');
process.stdin.on('data', function (chunk) {
ret += chunk;
stdin.on('readable', function () {
var chunk;
while (chunk = stdin.read()) {
ret += chunk;
}
});
process.stdin.on('end', function () {
stdin.on('end', function () {
cb(ret);

@@ -24,6 +29,7 @@ });

module.exports.buffer = function (cb) {
var stdin = process.stdin;
var ret = [];
var len = 0;
if (process.stdin.isTTY) {
if (stdin.isTTY) {
cb(new Buffer(''));

@@ -33,10 +39,14 @@ return;

process.stdin.on('data', function (chunk) {
ret.push(chunk);
len += chunk.length;
stdin.on('readable', function () {
var chunk;
while (chunk = stdin.read()) {
ret.push(chunk);
len += chunk.length;
}
});
process.stdin.on('end', function () {
stdin.on('end', function () {
cb(Buffer.concat(ret, len));
});
};
{
"name": "get-stdin",
"version": "3.0.2",
"version": "4.0.0",
"description": "Easier stdin",

@@ -16,3 +16,3 @@ "license": "MIT",

"scripts": {
"test": "node test.js && echo unicorns | node test2.js"
"test": "node test.js && node test-buffer.js && echo unicorns | node test-real.js"
},

@@ -19,0 +19,0 @@ "files": [

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc