文件操作 - call.mjs
返回文件管理
返回主菜单
删除本文件
文件: /var/www/OLD/node_modules/unenv/runtime/fetch/call.mjs
编辑文件内容
import { IncomingMessage } from "../node/http/_request.mjs"; import { ServerResponse } from "../node/http/_response.mjs"; const nullBodyResponses = /* @__PURE__ */ new Set([101, 204, 205, 304]); export function createCall(handle) { return function callHandle(context) { const req = new IncomingMessage(); const res = new ServerResponse(req); req.url = context.url || "/"; req.method = context.method || "GET"; req.headers = {}; if (context.headers) { const headerEntries = typeof context.headers.entries === "function" ? context.headers.entries() : Object.entries(context.headers); for (const [name, value] of headerEntries) { if (!value) { continue; } req.headers[name.toLowerCase()] = value; } } req.headers.host = req.headers.host || context.host || "localhost"; req.connection.encrypted = // @ts-ignore req.connection.encrypted || context.protocol === "https"; req.body = context.body || null; req.__unenv__ = context.context; return handle(req, res).then(() => { let body = res._data; if (nullBodyResponses.has(res.statusCode) || req.method.toUpperCase() === "HEAD") { body = null; delete res._headers["content-length"]; } const r = { body, headers: res._headers, status: res.statusCode, statusText: res.statusMessage }; req.destroy(); res.destroy(); return r; }); }; }
修改文件时间
将文件时间修改为当前时间的前一年
删除文件