Forcing "type" to be explicit, works best will rollup on the frontend to exclude depdendencies
13 lines
314 B
TypeScript
13 lines
314 B
TypeScript
import { type Readable } from 'stream';
|
|
|
|
export const streamToBuffer = async (stream: Readable): Promise<Buffer> => {
|
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
const chunks: any[] = [];
|
|
|
|
for await (const chunk of stream) {
|
|
chunks.push(chunk);
|
|
}
|
|
|
|
return Buffer.concat(chunks);
|
|
};
|