Files
code-center/src/modules/fm-manager/pipe-busboy.ts

13 lines
417 B
TypeScript

import { isBun } from '@/utils/get-engine.ts';
import http from 'node:http';
export const pipeBusboy = async (req: http.IncomingMessage, res: http.ServerResponse, busboy: any) => {
if (isBun) {
// @ts-ignore
const bunRequest = req.bun.request;
const arrayBuffer = await bunRequest.arrayBuffer();
const buffer = Buffer.from(arrayBuffer);
busboy.end(buffer);
} else {
req.pipe(busboy);
}
}