优化文件流处理,添加对 Bun 环境的支持,重构管道传输函数,改进内容类型获取逻辑

This commit is contained in:
2025-12-21 14:53:22 +08:00
parent d1e619d04c
commit 18a7c15a76
8 changed files with 160 additions and 17 deletions

View File

@@ -1,6 +1,12 @@
import { IncomingMessage } from 'node:http';
import http from 'node:http';
import { logger } from '../logger.ts';
export const isBun = typeof Bun !== 'undefined' && Bun?.version != null;
export const isNode = typeof process !== 'undefined' && process?.versions != null && process.versions?.node != null;
// @ts-ignore
export const isDeno = typeof Deno !== 'undefined' && Deno?.version != null && Deno?.version?.deno != null;
export const getUserFromRequest = (req: IncomingMessage) => {
const url = new URL(req.url, `http://${req.headers.host}`);