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 2.0.0 to 3.0.0

22

index.js
'use strict';
module.exports = function (cb) {
var ret = '';
process.stdin.setEncoding('utf8');
process.stdin.on('data', function (chunk) {
ret += chunk;
});
process.stdin.on('end', function () {
cb(ret);
});
};
module.exports.buffer = function (cb) {
var ret = [];
var len = 0;
process.stdin.on('data', function (data) {
ret.push(data);
process.stdin.on('data', function (chunk) {
ret.push(chunk);
len += chunk.length;
});
process.stdin.on('end', function () {
cb(Buffer.concat(ret));
cb(Buffer.concat(ret, len));
});
};

6

package.json
{
"name": "get-stdin",
"version": "2.0.0",
"version": "3.0.0",
"description": "Easier stdin",

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

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

@@ -33,5 +33,5 @@ "files": [

"devDependencies": {
"ava": "0.0.3",
"ava": "0.0.4",
"buffer-equal": "0.0.1"
}
}

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

stdin(function (data) {
console.log(data.toString());
console.log(data);
//=> unicorns

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

## API
### stdin(callback)
Get `stdin` as a string.
### stdin.buffer(callback)
Get `stdin` as a buffer.
## License
MIT © [Sindre Sorhus](http://sindresorhus.com)
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