const chunks: string[] = [];
stream.on('data', function (chunk: string) {
chunks.push(chunk);
});
// wait for the stream
await new Promise<void>((resolve, reject) => {
stream.on('end', resolve);
stream.on('error', reject);
});
const chunks: string[] = [];
stream.on('data', function (chunk: string) {
chunks.push(chunk);
});
// wait for the stream
await new Promise<void>((resolve, reject) => {
stream.on('end', resolve);
stream.on('error', reject);
});