Files
SnowLuma/.pnpm-store/v11/files/23/1eb578647e04b2b3c371f9de1a46d904d5e5336f22a2f45704afcdfd724919a64de82c366fc37c2c6392ef6c2b0bcf79e5066916491820e8bd2c4453939830
T
TanTan 2a69b23b47
Dev Build / cleanup (push) Waiting to run
Dev Build / typecheck (push) Waiting to run
docs: 仓库链接指向本镜像仓库
2026-11-13 09:27:07 +08:00

32 lines
971 B
Plaintext

Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
const require_middleware_serve_static_index = require("../../middleware/serve-static/index.js");
let node_fs_promises = require("node:fs/promises");
let node_path = require("node:path");
//#region src/adapter/bun/serve-static.ts
/**
* @deprecated `hono/bun` will be removed in v5. Install `@hono/bun` and import from there instead.
*/
const serveStatic = (options = {}) => {
return async function serveStatic(c, next) {
const getContent = async (path) => {
const file = Bun.file(path);
return await file.exists() ? file : null;
};
const isDir = async (path) => {
let isDir;
try {
isDir = (await (0, node_fs_promises.stat)(path)).isDirectory();
} catch {}
return isDir;
};
return require_middleware_serve_static_index.serveStatic({
...options,
getContent,
join: node_path.join,
isDir
})(c, next);
};
};
//#endregion
exports.serveStatic = serveStatic;