Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
The get-stdin package is a simple utility that allows you to easily read stdin as a string or buffer in Node.js. It's useful for command-line tools that need to process input piped to them from the command line.
Read stdin as a string
This feature allows you to read the standard input (stdin) as a string. It returns a promise that resolves with the entire input when the stdin stream ends.
const getStdin = require('get-stdin');
getStdin().then(input => {
console.log(input);
});
Read stdin as a buffer
This feature allows you to read the standard input (stdin) as a buffer. It returns a promise that resolves with the entire input as a buffer when the stdin stream ends.
const getStdin = require('get-stdin');
getStdin.buffer().then(input => {
console.log(input);
});
The raw-body package is similar to get-stdin but is more focused on parsing HTTP request bodies and provides more options for limiting size, setting character encoding, and handling errors.
Concat-stream is a writable stream that concatenates all the data from a stream and calls a callback with the result. It can be used in a similar way to get-stdin for collecting stream data, but it is not limited to stdin and does not return a promise.
Get-stream is a utility that turns a stream into a string or buffer. It is very similar to get-stdin but works with any stream, not just stdin, and offers more options for handling the stream data.
Get stdin as a string or buffer
$ npm install get-stdin
// example.js
import getStdin from 'get-stdin';
console.log(await getStdin());
//=> 'unicorns'
$ echo unicorns | node example.js
unicorns
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.
Get stdin
as a string
.
In a TTY context, a promise that resolves to an empty string
is returned.
Get stdin
as a Buffer
.
In a TTY context, a promise that resolves to an empty Buffer
is returned.
FAQs
Get stdin as a string or buffer
The npm package get-stdin receives a total of 13,168,625 weekly downloads. As such, get-stdin popularity was classified as popular.
We found that get-stdin demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.