优化文件流处理,添加对 Bun 环境的支持,重构管道传输函数,改进内容类型获取逻辑
This commit is contained in:
@@ -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}`);
|
||||
|
||||
Reference in New Issue
Block a user