mirror of
https://github.com/strapi/strapi.git
synced 2025-12-28 23:57:32 +00:00
apply fix o collect
This commit is contained in:
parent
afbfffe424
commit
fd226814d4
@ -6,12 +6,11 @@ import { Readable } from 'stream';
|
||||
export const collect = <T = unknown>(stream: Readable): Promise<T[]> => {
|
||||
const chunks: T[] = [];
|
||||
|
||||
return new Promise((resolve) => {
|
||||
stream.on('data', (chunk) => chunks.push(chunk));
|
||||
stream.on('end', () => {
|
||||
stream.destroy();
|
||||
resolve(chunks);
|
||||
});
|
||||
return new Promise((resolve, reject) => {
|
||||
stream
|
||||
.on('data', (chunk) => chunks.push(chunk))
|
||||
.on('close', () => resolve(chunks))
|
||||
.on('error', reject);
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user