Files
docmost/apps/server/src/integrations/storage/storage.utils.ts
Philipinho a821e37028 Refactoring
* Refactor workspace membership system
* Create setup endpoint
* Use Passport.js
* Several updates and fixes
2024-03-16 22:58:12 +00:00

11 lines
371 B
TypeScript

import { Readable } from 'stream';
export function streamToBuffer(readableStream: Readable): Promise<Buffer> {
return new Promise((resolve, reject) => {
const chunks: Uint8Array[] = [];
readableStream.on('data', (chunk) => chunks.push(chunk));
readableStream.on('end', () => resolve(Buffer.concat(chunks)));
readableStream.on('error', reject);
});
}