function streamToString(stream) {
	return new Promise((resolve, reject) => {
		let buffer = '';
		stream.setEncoding('utf-8');
		stream.on('data', data => {
			if (typeof data !== 'string') data = data.toString('utf-8');
			buffer += data;
		});
		stream.once('end', () => {
			resolve(buffer);
		});
		stream.once('error', reject);
	});
}
@param {import('stream').Readable} stream
@returns {Promise<string>}