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.41 node_modules/get-stdin/index.js
immosquare-cleaner-0.1.40 node_modules/get-stdin/index.js
immosquare-cleaner-0.1.39 node_modules/get-stdin/index.js
immosquare-cleaner-0.1.38 node_modules/get-stdin/index.js
immosquare-cleaner-0.1.32 node_modules/get-stdin/index.js
immosquare-cleaner-0.1.31 node_modules/get-stdin/index.js
immosquare-cleaner-0.1.30 node_modules/get-stdin/index.js
immosquare-cleaner-0.1.29 node_modules/get-stdin/index.js
immosquare-cleaner-0.1.28 node_modules/get-stdin/index.js
immosquare-cleaner-0.1.27 node_modules/get-stdin/index.js
immosquare-cleaner-0.1.26 node_modules/get-stdin/index.js
immosquare-cleaner-0.1.25 node_modules/get-stdin/index.js
immosquare-cleaner-0.1.24 node_modules/get-stdin/index.js
immosquare-cleaner-0.1.23 node_modules/get-stdin/index.js