Sha256: 35b451c1a4e32567a7d5e5966f8e2f990a83f49c991de96727b8b722ab41edf3

Contents?: true

Size: 497 Bytes

Versions: 34

Compression:

Stored size: 497 Bytes

Contents

'use strict';
const {stdin} = process;

module.exports = async () => {
	let result = '';

	if (stdin.isTTY) {
		return result;
	}

	stdin.setEncoding('utf8');

	for await (const chunk of stdin) {
		result += chunk;
	}

	return result;
};

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

	if (stdin.isTTY) {
		return Buffer.concat([]);
	}

	for await (const chunk of stdin) {
		result.push(chunk);
		length += chunk.length;
	}

	return Buffer.concat(result, length);
};

Version data entries

34 entries across 34 versions & 2 rubygems

Version Path
immosquare-cleaner-0.1.60 node_modules/get-stdin/index.js
immosquare-cleaner-0.1.59 node_modules/get-stdin/index.js
immosquare-cleaner-0.1.58 node_modules/get-stdin/index.js
immosquare-cleaner-0.1.57 node_modules/get-stdin/index.js
immosquare-cleaner-0.1.56 node_modules/get-stdin/index.js
immosquare-cleaner-0.1.55 node_modules/get-stdin/index.js
immosquare-cleaner-0.1.54 node_modules/get-stdin/index.js
immosquare-cleaner-0.1.53 node_modules/get-stdin/index.js
immosquare-cleaner-0.1.52 node_modules/get-stdin/index.js
trusty-cms-6.3.1 node_modules/get-stdin/index.js
immosquare-cleaner-0.1.51 node_modules/get-stdin/index.js
immosquare-cleaner-0.1.50 node_modules/get-stdin/index.js
immosquare-cleaner-0.1.49 node_modules/get-stdin/index.js
immosquare-cleaner-0.1.48 node_modules/get-stdin/index.js
immosquare-cleaner-0.1.47 node_modules/get-stdin/index.js
immosquare-cleaner-0.1.46 node_modules/get-stdin/index.js
immosquare-cleaner-0.1.45 node_modules/get-stdin/index.js
immosquare-cleaner-0.1.44 node_modules/get-stdin/index.js
immosquare-cleaner-0.1.43 node_modules/get-stdin/index.js
immosquare-cleaner-0.1.42 node_modules/get-stdin/index.js