Files
twenty/packages/twenty-server/src/utils/stream-to-buffer.ts
2023-12-10 18:10:54 +01:00

12 lines
244 B
TypeScript

import { Readable } from 'stream';
export const streamToBuffer = async (stream: Readable): Promise<Buffer> => {
const chunks: any[] = [];
for await (const chunk of stream) {
chunks.push(chunk);
}
return Buffer.concat(chunks);
};