mirror of
https://github.com/Crosstalk-Solutions/project-nomad.git
synced 2026-03-28 03:29:25 +01:00
9 lines
287 B
TypeScript
9 lines
287 B
TypeScript
import { Readable } from 'stream';
|
|
|
|
export const streamToString = async (stream: Readable): Promise<string> => {
|
|
const chunks: Buffer[] = [];
|
|
for await (const chunk of stream) {
|
|
chunks.push(Buffer.from(chunk));
|
|
}
|
|
return Buffer.concat(chunks).toString('utf-8');
|
|
}; |